【发布时间】:2021-08-24 22:45:30
【问题描述】:
这是同一个问题,在这里正确回答 jest global variable example ,但问题是 Typescript。
console.log(__DEV__);
结果:
error TS2304: Cannot find name __DEV__.
全局变量 __DEV__ 在 package.json 中定义为:
"jest": {
"globals": {
"__DEV__": true
}
}
有没有人解决或解决?
相关笑话文档:https://jestjs.io/docs/en/next/configuration#globals-object
【问题讨论】:
标签: typescript jestjs