小编Abh*_*Raj的帖子

将 Identity-obj-proxy 与 typescript 和 jest 一起使用时返回未定义

我在我的项目中使用 jest 和 typescript 。使用 Identity-obj-proxy 我的所有 .ts 文件都未定义,但 .js 文件按预期工作。

这是我的 tsconfig.json:

{
  "compilerOptions": {
    "target": "es5",
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "jsx": "react",
    "declaration": true,
    "sourceMap": true,
    "experimentalDecorators": true,
    "skipLibCheck": true,
    "outDir": "lib",
    "typeRoots": [
      "./node_modules/@types",
      "./node_modules/@microsoft"
    ],
    "types": [
      "es6-promise",
      "webpack-env"
    ],
    "lib": [
      "es5",
      "dom",
      "es2015.collection"
    ]
  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "node_modules",
    "lib"
  ]
}
Run Code Online (Sandbox Code Playgroud)

这是我的笑话配置:

"jest": {
    "unmockedModulePathPatterns": [
      "React"
    ],
    "moduleFileExtensions": [
      "ts",
      "tsx",
      "js"
    ],
    "transform": {
      "^.+\\.(d\\.ts|ts|tsx)$": "ts-jest" …
Run Code Online (Sandbox Code Playgroud)

typescript jestjs es6-proxy

6
推荐指数
1
解决办法
1万
查看次数

标签 统计

es6-proxy ×1

jestjs ×1

typescript ×1