Skip to main content
Version: 5.9

Usage with Babel

When compiling TS via babel, decorators are by default handled different implementation than what tsc uses. To make the metadata extraction from decorators via Babel work, we need to do use following plugins:

"plugins": [
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }]

Make sure to install the plugins first: yarn add -D babel-plugin-transform-typescript-metadata @babel/plugin-proposal-decorators @babel/plugin-proposal-class-properties

Lastly we need to set the BABEL_DECORATORS_COMPAT environment variable to true to adjust the return value of decorators.

More information about this topic can be found here: