Convert @babel/traverse to TypeScript (#12488)
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user