The production version of TypeScript 3.4, the latest version of Microsoft’s typed superset of JavaScript, has arrived, with improvements for builds and type-checking.
Where to download TypeScript
You can download TypeScript through NuGet, or you can get it via NPM:
npm install -g typescript
Current version: The new features in TypeScript 3.4
- A new compilation flag,
--incremental
, provides faster subsequent builds. This flag tells TypeScript to save information about the project graph from the last compilation. When TypeScript is again invoked with--incremental
, it will use the data to detect the least costly way to type-check and emit project changes. - Type-checking is introduced for the ECMAScript
globalThis
global variable, providing a standard way for accessing the global scope that can be used across different environments. - It is now easier to read-only array types, with a new syntax for
ReadonlyArray
using aReadonly
modifier for array types. - Support is introduced for read-only tuples; any tuple type can be prefixed with the
readonly
keyword to make it a read-only tuple. - The
readonly
modifier in a mapped type automatically will convert array-like types to a corresponding read-only array type. - A new construct has been introduced for literal values,
const
assertions. The syntax is a type assertion withconst
in place of the type name. When literal expressions are constructed withconst
assertions, developers can signal that no literal type in that expression should be widened, that object literals getreadonly
properties, and that array literals becomereadonly
tuples. - As a breaking change, the type of top-level
this
is now typed astypeof globalThis
instead ofany
. As a consequence, developers might receive errors for accessing unknown values onthis
andnoImplicitAny
. - Another breaking change is that improved inference in TypeScript 3.4 might produce generic functions rather than functions that take and return constants.