4 ms·
I've wondered about this, in the context of generating skeleton Typescript definition files automatically by analysing the source of the library. It appears tha
by tomduncalf 10y ago
I've wondered about this, in the context of generating skeleton Typescript definition files automatically by analysing the source of the library. It appears that Tern (http://ternjs.net/ http://ternjs.net/) is the most advanced project for extracting this kind of information from Javascript source files, and can be used as an editor plugin for some degree of intelligent autocompletion. You could also potentially use Esprima (http://esprima.org/doc/ http://esprima.org/doc/) to analyse the AST.
The old Visual Studio Javascript autocomplete engine apparently worked in a similar way to what you suggest, running the code in a sandbox and then analysing the types, but they've now moved to a static engine (which I think is also used in VS Code?) - some information at https://blogs.msdn.microsoft.com/visualstudio/2016/04/08/previewing-salsa-javascript-language-service-visual-studio-15/ https://blogs.msdn.microsoft.com/visualstudio/2016/04/08/pre...
- WorldMaker 10y agoThe new engine ("Salsa") is actually powered by Typescript, which is neat.