Compilation breaks with TypeScript 3.9
See original GitHub issueUpgraded a project from Typescript 3.8.2 to TypeScript 3.9.2. The project is using the latest Objection (2.1.3).
After the TS upgrade, the project fails to compile with compilation errors related to Objection types.
I suspect this is related to “Stricter Checks on Intersections and Optional Properties” as described here.
node_modules/objection/typings/objection/index.d.ts:268:43 - error TS2344: Type 'Model & T' does not satisfy the constraint 'Model'.
The types of 'QueryBuilderType.findById(...).update(...).page(...).insertGraph' are incompatible between these types.
Type 'InsertGraphMethod<Model & T>' is not assignable to type 'InsertGraphMethod<Model>'.
Types of parameters 'graph' and 'graph' are incompatible.
Type 'PartialModelGraph<Model, Model & GraphParameters>' is not assignable to type 'PartialModelGraph<Model & T, Model & T & GraphParameters>'.
268 ? SingleQueryBuilder<QueryBuilderType<T>>
~
node_modules/objection/typings/objection/index.d.ts:271:26 - error TS2344: Type 'Model & I' does not satisfy the constraint 'Model'.
The types of 'QueryBuilderType.findById(...).update(...).page(...).insertGraph' are incompatible between these types.
Type 'InsertGraphMethod<Model & I>' is not assignable to type 'InsertGraphMethod<Model>'.
Types of parameters 'graph' and 'graph' are incompatible.
Type 'PartialModelGraph<Model, Model & GraphParameters>' is not assignable to type 'PartialModelGraph<Model & I, Model & I & GraphParameters>'.
271 ? QueryBuilderType<I>
~
node_modules/objection/typings/objection/index.d.ts:281:24 - error TS2344: Type 'Model & T' does not satisfy the constraint 'Model'.
The types of 'QueryBuilderType.findById(...).update(...).page(...).insertGraph' are incompatible between these types.
Type 'InsertGraphMethod<Model & T>' is not assignable to type 'InsertGraphMethod<Model>'.
Types of parameters 'graph' and 'graph' are incompatible.
Type 'PartialModelGraph<Model, Model & GraphParameters>' is not assignable to type 'PartialModelGraph<Model & T, Model & T & GraphParameters>'.
281 ? QueryBuilderType<T>
~
node_modules/objection/typings/objection/index.d.ts:284:26 - error TS2344: Type 'Model & I' does not satisfy the constraint 'Model'.
The types of 'QueryBuilderType.findById(...).update(...).page(...).insertGraph' are incompatible between these types.
Type 'InsertGraphMethod<Model & I>' is not assignable to type 'InsertGraphMethod<Model>'.
Types of parameters 'graph' and 'graph' are incompatible.
Type 'PartialModelGraph<Model, Model & GraphParameters>' is not assignable to type 'PartialModelGraph<Model & I, Model & I & GraphParameters>'.
284 ? QueryBuilderType<I>```
Issue Analytics
- State:
- Created 3 years ago
- Reactions:15
- Comments:15 (1 by maintainers)
Top Results From Across the Web
Documentation - TypeScript 3.9
TypeScript 3.9 addresses this issue by changing the internals of how the compiler and language service caches file lookups.
Read more >Programming language TypeScript 3.9 cuts compile times by ...
A Microsoft engineer who works on the Outlook Web App says upgrading to TypeScript 3.9 has cut his compile times from 26 seconds...
Read more >Announcing TypeScript 3.9 - Microsoft Developer Blogs
TypeScript 3.9 addresses this issue by changing the internals of how the compiler and language service caches file lookups.
Read more >TypeScript 3.9 slashes compile times for packages - InfoWorld
Latest TypeScript production release addresses extremely poor editing and compilation speeds associated with packages.
Read more >compile errors with v4.4.x under typescript 3.9.x and node 14
Since typescript does not restrict breaking changes to major versions we consider this support best effort. If you run into any unexpected ...
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
The fix is now released. No need for any workarounds.
Disabling
"strict"
turns TS into a glorified linter.A better workaround is to import the git branch with the fix. Or fork the repo at the last released version and cherry-pick the fix.