Description
Since basically every interesting method of this library is dynamically generated, it's impossible for IDE's like WebStorm to provide much help with autocompletion and/or static type analysis. I don't want to know how many hours I have lost context switching between my code and def/*
, trying to figure out what the correct signature was for various build methods.
I created a minimal one by hand (currently only supports Identifier
, ReturnStatement
, and AssignmentExpression
).
Note that it's utility would not be limited to Typescript users. IDE's can use them to provide hints for plain old javascript code as well. All the screenshots below are actually code hints generated for a javascript file.
Webstorm just knows the type of the assign
variable.
Everything we need to auto-generate the definition file is already in def/*
, but we would probably need to extend Type
to expose the information it contains in a format readily consumed by the generator (I guess I could parse Type
s toString
output, but that seems unnecessarily difficult).
The generated file for the default language definitions shipped with ast-types
should probably be deployed into npm
as a static asset, but it would also be possible to generate it via a postinstall
script. Ideally we would provide programmatic access as well, so those extending the language definitions (i.e. #57) could create their own definition files that reflect their modifications.
I am happy to submit a PR if @benjamn is on board. I am not sure how close #57 is to being a reality, but it would be nice to see what direction you were taking with that before starting on this in earnest.