I use typeorm with next.js and typescript, my tsconfig.json is:
{
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext",
"es5",
"es6"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"jsx": "preserve"
},
include: ...
}
I set experimentalDecorator is true. My typescript is 3.9.7 and my typeorm is 0.2.25. The compile error is:
error - ./db/entity/User.ts:7:1
Syntax error: Support for the experimental syntax 'decorators-legacy' isn't currently enabled:
5 |
6 |
> 7 | @Entity()
| ^
8 | export class User {
9 |
10 | @PrimaryGeneratedColumn()
I already enable emitDecoratorMetadata, Hoe to make decorators-legacy enable for tsconfig.json