【发布时间】:2022-11-10 16:11:54
【问题描述】:
我正在从 jest v27 迁移到 v29 并遇到此错误:
node_modules/@jest/environment/build/index.d.ts:329:26 - error TS2430: Interface 'JestImportMeta' incorrectly extends interface 'ImportMeta'.
The types returned by 'jest.createMockFromModule(...)' are incompatible between these types.
Type 'unknown' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to 'unknown'.
329 export declare interface JestImportMeta extends ImportMeta {
~~~~~~~~~~~~~~
Found 1 error in node_modules/@jest/environment/build/index.d.ts:329
尝试使用tsc 进行编译时会发生此错误。
我的 package.json 中的相关包:
"devDependencies": {
"@types/jest": "^29.0.0",
"jest": "^29.0.0",
"jest-environment-node": "^29.0.0",
"nodemon": "^2.0.4",
"ts-jest": "^29.0.0"
}
版本:
- NodeJs
v16.15.1 - npm
v8.11.0
【问题讨论】:
标签: node.js typescript jestjs