It is the same question, as correctly answered here jest global variable example , but the concern is Typescript.
console.log(__DEV__);
Results in:
error TS2304: Cannot find name __DEV__.
The global var __DEV__ is defined in package.json as:
"jest": {
"globals": {
"__DEV__": true
}
}
Has anybody a solution or work around?
Relevant jest documentation: https://jestjs.io/docs/en/next/configuration#globals-object