New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable noImplicitAny and type everything properly #2066
Comments
I had a good go at this, but ran into two issues:
For example there's this code (types added): visitComment(node: NodeComment, metadata: Metadata): void {
const type = (node.type[0] === 'L') ? 'Line' : 'Block'; But that's literally the only place where
switch (expr.type) {
...
case Syntax.AssignmentExpression:
expr.type = Syntax.AssignmentPattern;
delete expr.operator; That is pretty horrible. Not just because Typescript can't deal with it. Now you have an object whose In any case, I think really only the original authors have enough knowledge to do this in a reasonable amount of time because it requires inferring intent. I also found that the type declarations for the currently released version are not as bad as I though. Weirdly they assume that the AST conforms to the Espree type definitions, but you don't actually use those in Esprima for some reason. I can put my attempt up somewhere if you like. |
Using Typescript is great (when type declarations are shipped anyway), but it's kind of rubbish that so many of the types are just
any
. It would be a good idea to enable thenoImplicitAny
option and then fix all of the errors. For example here are the types for the main functions:Not very useful!
The text was updated successfully, but these errors were encountered: