【发布时间】:2018-11-06 00:05:31
【问题描述】:
当我在 Typescript 项目中使用 Jest 启动测试套件时,出现以下编译错误:
类型错误: /PATH/instant.ts: 无法读取未定义的“某些”属性
在我的 package.json 中,我有这个 Jest 配置:
"jest": {
"preset": "react-native",
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/src/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js"
],
"collectCoverage": true,
"coverageReporters": [
"json",
"html"
]
}
Instant.ts:
export class Instant {
constructor(private id: string,
private name: string) {
}
}
还有 Instant.js:
export class Instant {
constructor(id, name) {
this.id = id;
this.name = name;
}
}
//# sourceMappingURL=instant.js.map
【问题讨论】:
-
我想我们需要看看
instant.ts的一些代码 -
@Fenton 我更新了我的问题
-
代码中没有
some。 -
我的代码中没有“一些”
标签: typescript jestjs