Re:Using TypeScript with React
by jimmyspice on Thursday August 22, 2019 @01:53PM
(#20770695)
@types versioning is strange because you never know whether or not the version of the types matches the dependency exactly. for example the case where the typed version has a minor upgrade (say due to increased type coverage), the types become out of sync.
the fix is to do away with @types and export types from the dependency itself so they are always in sync
Re:Using TypeScript with React
by WorldMaker on Thursday August 22, 2019 @01:39PM
(#20770550)
I find after a fresh `npm install` (as opposed to `npm ci` which pays attention to package-lock.json) an `npm dedupe` almost always seems necessary. `npm install` by default still doesn't seem to work hard enough to avoid duplication, especially with @types/ packages where is often critical.
Re:Using TypeScript with React
by charrondev on Thursday August 22, 2019 @12:58PM
(#20770140)
Looks into the “resolutions” field for yarn. It does exactly this.
Same applies to most regular npm packages as well, for example you really only want a single version of "react", too.