Prerequisites

The TypeScript features in this chapter require TypeScript 1.5 or higher and the following options to be enabled in the tsconfig.json file:

"experimentalDecorators": true, 
"emitDecoratorMetadata": true 
As indicated by the experimental decorators compilation flag, the decorator's API is considered experimental. This doesn't mean that it is not ready for production usage. It means that the decorator API is subject to potential breaking changes in the future.

We are also going to need a polyfill for the reflectmetadata API. We need a polyfill because most JavaScript engines don't support this API yet. We can expect that, in the long term, this polyfill will not be required but, currently, we can use the reflect–metadata npm module: ...

Get Learning TypeScript 2.x - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.