Skip to content

Instantly share code, notes, and snippets.

@wisetc
Created July 29, 2019 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wisetc/275b803bb3b5b9b28155a6b4f797d00d to your computer and use it in GitHub Desktop.
Save wisetc/275b803bb3b5b9b28155a6b4f797d00d to your computer and use it in GitHub Desktop.
Basic typescript/javascript project configuration for react.
{
"compilerOptions": {
"allowJs": true,
"target": "es2015",
"baseUrl": "./src",
"outDir": "./build",
"jsx": "react",
"moduleResolution": "node",
"suppressImplicitAnyIndexErrors": true,
"allowSyntheticDefaultImports": true
},
"include": [
"./src/**/*"
]
}
@wisetc
Copy link
Author

wisetc commented Jul 29, 2019

allowSyntheticDefaultImports: use import React instead of import * as React

@wisetc
Copy link
Author

wisetc commented Jul 29, 2019

suppressImplicitAnyIndexErrors : to check property out of object error

@wisetc
Copy link
Author

wisetc commented Jul 29, 2019

moduleResolution : to support node modules import syntax.

@wisetc
Copy link
Author

wisetc commented Jul 29, 2019

add checkJs: true or // @ts-check to support js type check.

@wisetc
Copy link
Author

wisetc commented Jul 31, 2019

to support Promise.finally, target should be es2018, or esnext.:smile:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment