Tallan's Blog

Tallan’s Experts Share Their Knowledge on Technology, Trends and Solutions to Business Challenges

Posts Tagged "Functional Programming"

StaticDynamicInference

Synthetic Type Inference in JavaScript

Aesa Kamar

TypeScript is Microsoft’s Open Source solution to the dynamic nature of JavaScript. It served the job of making code safer and more maintainable, but a lot of people find it bulky and cumbersome to use. By enabling a new compiler flag in VS Code, you can get IntelliSense, static type information, and code completion for free. And the best part is, you can keep writing vanilla JavaScript!

 
To start, you can add a file called “jsconfig.json” to the root of your project. You’ll need to add some compiler options, and set “allowSyntheticDefaultImports” to true.

 
This allows the VSCode precompiler to get type information about your variables and functions, presenting you with handy information when you hover over a symbol.

 
You can get type information about primitives, or even more complex objects.

 
And your es6 class declarations too!

 
The synthetic type inference is smart and can…

\\\