-
Type: Task
-
Resolution: Done
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
NODE-4594 Description
What problem are you facing?
TypeScript processing (type checking and transpilation) is severely slowed down when types with high count of unique key names, enum values, type unions, and recursion are passed to MongoDB collection methods.
TypeScript processing ultimately fails with the following errors most prevalent:
error TS2589: Type instantiation is excessively deep and possibly infinite.
error TS2615: Type of property 'prop49' circularly references itself in mapped type
What driver and relevant dependency versions are you using?
bson: ~4.7.0 mongodb: ~4.9.0 typescript: ~4.8.2
Steps to reproduce?
Please consult minimal reproduction repository:
https://github.com/thinkalpha/node-mongodb-typechecking-performance
Install dependencies ( npm i ) and run npm exec tsc --incremental false to reproduce the issue. Consult class.ts for Driver call sites and the individual model types for additional detail. The "circular" reference example is minimal, while the "slow" example is an anonymized real-world data model. Both employ recursive types.
- is depended on by
-
NODE-4594 v4 query type checking adversely impacts environments with advanced document types
- Closed