Ekoar
Ekoar

Reputation: 481

expo typescript template generated with error

I just started my first react native with expo and typescript project, I have upgraded my expo and nodejs to the latest version and then run this command

npx create-expo-app -t expo-template-blank-typescript

to generate a new project. however, I have no idea why there are some errors....

like (Type 'boolean' is not assignable to type 'View'.)

and Operator '>' cannot be applied to types '{ styles: any; "": any; }' and 'Text'.

can someone help me?

21/12/2022 updated :

solution: remove Javascript and Typescript Nightly from VSC extensions**

enter image description here

enter image description here

Upvotes: 2

Views: 897

Answers (1)

TOPKAT
TOPKAT

Reputation: 8638

make sure the tsconfig.json file look like this:

{
  "extends": "expo/tsconfig.base", // this allow JSX to be used among other things
  "compilerOptions": {
    // you can set this to false for a more permissive setup
    "strict": true,
    // set this only for a more permissive ts typechecking
    "noImplicitAny": false,
  }
}

If that doesn't work:

  • Try to build your project with tsc command to see if it fails
  • Restart your IDE as sometimes is just an error with vscode

noImplicitAny documentation
strict documentation

Upvotes: 1

Related Questions