Riddle me this: TypeScript's latest data type is literally unknown
Version 3.0 improvements in Microsoft's lang also include pumped up tuples
That code can then be run in any ECMAScript runtime, such as a browser or Node.js, he explained.
A programming language that support data types helps makes type-related errors easier to catch and can reduce the amount of unit tests developers need to write to verify their code, though dealing with data types demands a bit more work up front.
TypeScript 3.0 adds a feature called "project references" that allows devs to specify how one TypeScript project depends on another, through paths added to
tsconfig.json files that point to other configuration files.
Specifying such dependencies allows projects to be broken up into more manageable chunks and can accelerate builds. And there's now a
--build flag to take advantage of incremental builds.
Now the language treats rest parameters as generic and turns them into tuples, inferring the data types involved along the way. According to Rosenwasser, Microsoft's TypeScript team had to do some work on tuple types to make this work.
Error messages have also received some attention since last TypeScript release, making them shorter and clearer.
Official: Perl the most hated programming language, say devsREAD MORE
There's a new data type, called
unknown, that differs from another catch-all data type, called
unknown is assignable to almost nothing else without a type assertion," explains Rosenwasser. "You also can’t access any properties off of an
unknown, nor can you call/construct them."
unknown data type might be useful in a place where a dev wants to ensure that type checking is performed or that a type assertion is used. It also happens to represent one of the breaking changes – since
unknown is now a reserved word, previous TypeScript code that used it as a variable name won't perform as expected.
"Going forward, we foresee bringing more value to the type system and tooling experience, polishing the existing work on project references, and making TypeScript (both the language and the project) more approachable by whatever means we can," said Rosenwasser. ®