Convert @babel/traverse to TypeScript (#12488)

Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
Bogdan Savluk
2021-01-24 01:33:09 +01:00
committed by GitHub
parent cd090e9842
commit d98418efbe
37 changed files with 2023 additions and 368 deletions

View File

@@ -40,9 +40,9 @@ export default function traverse<T>(
function traverseSimpleImpl<T>(
node: any,
enter: Function | undefined | null,
exit: Function | undefined | null,
state: T | undefined | null,
enter: Function | undefined,
exit: Function | undefined,
state: T | undefined,
ancestors: TraversalAncestors,
) {
const keys = VISITOR_KEYS[node.type];

View File

@@ -14,10 +14,7 @@ export default function isType(
/**
* Test if a `nodeType` is a `targetType` or if `targetType` is an alias of `nodeType`.
*/
export default function isType(
nodeType: string | undefined | null,
targetType: string,
): boolean {
export default function isType(nodeType: string, targetType: string): boolean {
if (nodeType === targetType) return true;
// This is a fast-path. If the test above failed, but an alias key is found, then the