Jos*_*567 19 types node.js sequelize.js typescript tsc
我有一个项目,当我运行“tsc”时显示此错误:
../modules/node_modules/sequelize/types/lib/transaction.d.ts:33:14 - error TS1086: An accessor cannot be declared in an ambient context.
33 static get LOCK(): LOCK;
~~~~
../modules/node_modules/sequelize/types/lib/transaction.d.ts:40:7 - error TS1086: An accessor cannot be declared in an ambient context.
40 get LOCK(): LOCK;
~~~~
Run Code Online (Sandbox Code Playgroud)
我的版本是:
该项目在 nodemon 上运行良好,但在我尝试编译打字稿时失败。有人知道这个错误吗?
谢谢。
kri*_*tel 39
我有Angular 8。它正在使用 3.4.5 的打字稿版本。所以解决这个问题做下面的步骤。
步骤 1) 转到tsconfig.json文件
步骤2)在“compilerOptions”对象中添加skipLibCheck:true。这个对我有用。
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"strict": true,
"target": "es5",
"declaration": true,
"declarationDir": "dist-debug/",
"skipLibCheck": true, /// Needs to be true to fix wrong alias types being used
},
Run Code Online (Sandbox Code Playgroud)
Avi*_*dad 20
您需要使用打字稿 3.7。
To detect the issue around accessors, TypeScript 3.7 will now emit get/set accessors in .d.ts files so that in TypeScript can check for overridden accessors.
Run Code Online (Sandbox Code Playgroud)
所以大概sequelize是用 typescript 3.7 编译的,并发出以前版本不理解的定义文件。因此,您需要升级到 typescript 3.7 或使用更早版本的 sequelize。
| 归档时间: |
|
| 查看次数: |
18993 次 |
| 最近记录: |