You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question: should we use allowSyntheticDefaultImports:true or skipLibCheck:true in every React project? #8964
If I write a library usingimport React from 'react';.
Then downstream users must enable allowSyntheticDefaultImports or skipLibCheck, otherwise they will not be able to use this library in Typescript.
For users who configure webpack and tsconfig themselves, it is common to turn off allowSyntheticDefaultImports and skipLibCheck(default behavior).
Question: Which of the following two methods is more recommended?
Force each project to force skipLibCheck.
Force each project to force enableSyntheticDefaultImports.
We should recommend the author of the library to use import * as React from 'react';, but not restrict library users to use import * as React from 'react'; or import React from 'react';
Whichever method we choose, we should specify this behavior in the react / create-react-app / TypeScript documentation website, and we should have some more detailed suggestions for the react library authors and react library users.
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
WRT: allowSyntheticDefaultImports my personal preference is to have it off, but that depends on the RFC results in general (and probably a shift in culture overall to * as x)
This will be much faster, and I will also set skipLibCheck:true in development.
But this will hide the library errors, so I usually set skipLibCheck: false when compiling in production mode.
Activity
stale commentedon Jun 6, 2020
This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.
ianschmitz commentedon Jun 6, 2020
Once the react RFC is figured out we can provide recommendations here I think.
orta commentedon Jun 6, 2020
FWIW, we recommend
skipLibCheckas true since 3.9WRT:
allowSyntheticDefaultImportsmy personal preference is to have it off, but that depends on the RFC results in general (and probably a shift in culture overall to* as x)xiaoxiangmoe commentedon Jun 7, 2020
@orta why we should enable skipLibCheck since 3.9?
ianschmitz commentedon Jun 7, 2020
In my experience type checking is significantly faster with
skipLibCheckon.xiaoxiangmoe commentedon Jun 8, 2020
This will be much faster, and I will also set
skipLibCheck:truein development.But this will hide the library errors, so I usually set
skipLibCheck: falsewhen compiling in production mode.