7

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 undefined Though 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.

Sam
  • 159
  • 1
  • 2
  • 12

0 Answers0