TypeScript 2.5
TypeScript 2.5 introduces the ability to assert the type of expressions when using plain JavaScript in your projects.The syntax is an /* @type {…} /
annotation comment followed by a parenthesized expression whose type needs to be re-evaluated.For example:
var x = /** @type {SomeType} */ (AnyParenthesizedExpression);
As a nice bonus, this can also reduce the memory and runtime footprint of the compiler and language service by avoiding loading .d.ts
files from duplicate packages.
In this mode, references to modules and packages (e.g. import
s and directives) are all resolved relative to the location of the symbolic link file, rather than relative to the path that the symbolic link resolves to.For a more concrete example, we’ll defer to .