You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thanks for this great tool and its types.
Just found a situation that I don't understand fully. Seems that ASTPath is not compatible with ASTPath, which is weird because Function just extends ASTNode (as far as I know)
The whole error is like this:
Overload 2 of 2, '(source: ASTNode | ASTNode[] | ASTPath<ASTNode> | ASTPath<ASTNode>[]): Collection<any>', gave the following error.
Argument of type 'ASTPath<Function>' is not assignable to parameter of type 'ASTNode | ASTNode[] | ASTPath<ASTNode> | ASTPath<ASTNode>[]'.
Type 'NodePath<Function, Function>' is not assignable to type 'ASTPath<ASTNode>'.
Type 'Function' is not assignable to type 'ASTNode'.
Property 'key' is missing in type 'Function' but required in type 'ClassPrivateMethod'.ts(2769)
The error is happening when I have a Function node that then I try to pass to JSCodeshift, which function signature is as you see above. If I just ignore the type error the code seems to work fine, but I am not sure if it is because I am only getting "compatible" nodes because Function is compatible with many subtypes.
Some example code may look like this:
j(file.source).find(j.Function).filter((path)=>{j(path)// <- here is where the error happens})
The text was updated successfully, but these errors were encountered:
Hello, thanks for this great tool and its types.
Just found a situation that I don't understand fully. Seems that ASTPath is not compatible with ASTPath, which is weird because Function just extends ASTNode (as far as I know)
The whole error is like this:
The error is happening when I have a Function node that then I try to pass to JSCodeshift, which function signature is as you see above. If I just ignore the type error the code seems to work fine, but I am not sure if it is because I am only getting "compatible" nodes because Function is compatible with many subtypes.
Some example code may look like this:
The text was updated successfully, but these errors were encountered: