Re:Runtime type information for JavaScript
by antiufo on Sunday September 17, 2017 @02:47PM
(#15271059)
The JavaScript intellisense engine of previous versions of Visual Studio used to instrument a sandboxed JS engine in order to extract the shape of objects and methods used in the code, so it also worked when unusual idioms for structuring code were used.
Recent versions use instead the TypeSript compiler, with support for plain JavaScript and flow analysis.
Re:Runtime type information for JavaScript
by WorldMaker on Monday September 18, 2017 @01:00PM
(#15277553)
Recent versions of Typescript also pay attention to JSDoc type hints and will even check them for you and start reporting "lint errors" if you just add a `// @ts-check` magic comment to the file. It can be a particularly quick way to bootstrap a project with a lot of JS a file at a time towards static typing. (Personally, I still prefer the "rip off the bandaid" approach of just renaming every JS file to TS and fix compile errors until it builds, but it's great to have options.)
Re:Runtime type information for JavaScript
by tryckbarpingvin on Sunday September 17, 2017 @02:56PM
(#15271102)
That sounds useful! Maybe helpful for you is that YouCompleteMe for Vim is able to offer some type inference based on usage.
Or a linter could give optimization recommendations: "Warning: Function deoptimized at runtime because in 2% of calls to this function parameter x is an object."