mohamedhegazy
mohamedhegazy on Hacker News
No. TypeScript has no dependency on classes the way Java or C# does; nor is class-oriented code the recondeded style by the TS team. As a matter of fact the typescript compiler core is all written as functions and immmutable objects with no classes (except for a polyfill for Map and Set).
TypeScript 2.3 has support for vue.js this injection style patterns (see https://github.com/Microsoft/TypeScript/pull/14141) which are way out of the realm of class-centric programming languages. Similarly the inference cabalities (expanded in 2.4) and the fundamental nature of the type system being structural rather than nominal is another give away of the language nature and direction.
So the short answer is TypeScript is a superset of JavaScript; and is as class-centric as JavaScript is.
you could. jsut add `@ts-check` in your .js file, open it in VSCode, or pass it to the `tsc --allowjs a.js` on the commandline.
TypeScript has `--target ESNext` this will strip out any TypeScript-specific type annotations, and leave you with standard-track-only JS code that looks identical to your input (modulo type annotations).
Without `--strictNullChecks`, both `undefined` and `null` are in the domain of all types.
`--noImplicitAny` is the recommended flag. It is not set by default to ease the use on JS code bases.
The new changes makes `--noImplicitAny` require less type annotations; where the compiler can figure out the type of a variable through following the control flow.
You can just use `--target ESNext` and this will disable all ES features transformations and just erase types.
We have been testing this on insider builds of vscode for a few weeks as well as preview builds of visual studio with no issues. We were just notified today by npm that we are flooding their servers.
The TypeScript team will do feature work to minimize npm requests via a well-known cached list of packages.
async-await transpilation for ES5/ES3 target is already available in the nightly drops of TS (`typescript@next`).
async-await for ES5/ES3 is already available in `typescript@next`. give it a try.