TypeORM OneToMany causes “ReferenceError: Cannot access '' before initialization”

后端 未结 3 1500
甜味超标
甜味超标 2021-01-01 02:36

I have two entities: User and Habit. A user can create multiple Habits, thus I use a OneToMany relation on the User (and

3条回答
  •  甜味超标
    2021-01-01 02:48

    In tsconfig, setting the target to "esnext" and module to "commonjs" fixed the issue for me

    {
      "extends": "../../tsconfig.json",
      "compilerOptions": {
        "types": ["node", "jest"],
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "module": "commonjs",
        "target": "esnext"
      },
      "include": ["**/*.ts"]
    }
    

提交回复
热议问题