Put TypeScript configuration in react-scripts instead of individual project? (TS3.2+)
See original GitHub issueIs this a bug report?
No
Motivation
TypeScript 3.2, released November 29th, 2018, now uses Node.js-based resolution for tsconfig.json inheritance
TypeScript 3.2 now resolves
tsconfig.jsons
fromnode_modules
. When using a bare path for the"extends"
field intsconfig.json
, TypeScript will dive intonode_modules
packages for us.{ "extends": "@my-team/tsconfig-base", "include": ["./**/*"] "compilerOptions": { // Override certain options on a project-by-project basis. "strictBindCallApply": false, } }
TypeScript will look for "tsconfig"
field in package.json
to determine the configuration file to use.
Therefore, the generated tsconfig.json
could be reduced to
{ "extends": "react-scripts", "include": ["src"] }
This would further reduce configuration in create-react-app projects.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Adding TypeScript - Create React App
TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Installation. To start a new Create React App project with ...
Read more >Setting TypeScript For Modern React Projects Using Webpack
There are several ways to set up TypeScript in a React Project. In this tutorial, we'll be covering just two. Method 1: Create...
Read more >Migrating from create-react-app-typescript to Create React App
Let's get to it. #Step 1: remove react-scripts-ts, add react-scripts. Create React App is a command line application that generates a basic ...
Read more >Migrating create-react-app from javascript to typescript
Create a temporary react project with typescript by running the command create-react-app --scripts-version=react-scripts-ts (Note - requires ...
Read more >Getting Started with React and TypeScript | Pluralsight
Getting Started Using Create React App (CRA) ; # Generate a new React Typescript project 2npx create-react-app my-typescript-app --typescript 3 4 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yay! We requested this over a year and a half ago: https://github.com/Microsoft/TypeScript/issues/15984
Hiding the configuration doesn’t make it unconfigurable.
TypeScript configs like
target
,lib
,jsx
,no*
, etc can evolve over time as browser tech evolve. The goal should be to allow users to upgrade to latest practice by just upgradingreact-scripts
and not have to copy the latesttsconfig.json
from the source code.