Infer Types for Rest and Spread Properties in TypeScript

Share this video with your friends

Send Tweet

TypeScript supports rest and spread properties for objects, which are slated for standardization in ECMAScript 2018. It automatically infers rest and spread types so that you can use object spread and rest elements in a statically typed manner without having to manually add type annotations.

Jodi Warren
Jodi Warren
~ 7 years ago

At 6:25, you execute a TypeScript file directly in Node. Have you aliased ts-node to node, or is there another handy tip which I don't know about?

Marius Schulz
Marius Schulz(instructor)
~ 7 years ago

@Jodi: While the file has a .ts extension, it is still just a plain JavaScript file with no TypeScript syntax at all. Therefore, Node can run it without any problems (and doesn’t care about the file extension).

Jodi Warren
Jodi Warren
~ 7 years ago

Of course it is! Thanks Marius, that makes perfect sense.