Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6212

React Native: Show runtime errors while compiling

$
0
0

I am using TypeScript in my react-native project and it works fine. The only problem I am having is that, the IDE shows me the errors and everything. But I am still able to run my project even if there are some typescript errors.For example if I have a typescript error for example

 type something = 'abc'
const fn(arg: something){ }fn('somethingelse')

The IDE will show that somethingelse is not assigned to abc.But when I Reload the app/bundle. It still compiles.I have added some of my typescript configuration files

tsconfig.json

{"compilerOptions": {"baseUrl": "app","target": "es2018","lib": ["dom", "dom.iterable", "esnext"],"jsx": "preserve","allowJs": true,"allowSyntheticDefaultImports": true,"allowUnreachableCode": false,"declaration": false,"downlevelIteration": true,"emitDecoratorMetadata": true,"experimentalDecorators": true,"esModuleInterop": true,"forceConsistentCasingInFileNames": true,"importHelpers": false,"isolatedModules": true,"noFallthroughCasesInSwitch": true,"noImplicitAny": true,"noImplicitReturns": true,"noImplicitThis": true,"noLib": false,"noUnusedParameters": true,"noUnusedLocals": true,"pretty": true,"resolveJsonModule": true,"skipLibCheck": true,"removeComments": true,"sourceMap": true,"strict": true,"suppressImplicitAnyIndexErrors": true,"module": "esnext","moduleResolution": "node","noEmit": true  },"typeAcquisition": {"include": ["jest"]  },"include": ["app/**/*", "test-utils"]}

And when I also do yarn tsc I get this error

TypeError: Cannot read property 'kind' of undefinedThough tsc --w works, But I want these errors at runtime so that I can fix them whenever they occur. Right now I am only seeing these errors on IDE. but it still compiles.


Viewing all articles
Browse latest Browse all 6212

Trending Articles