-
Type: Task
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: TypeScript
jer-sen has created PR #3349: Fix type for nested objects in query & update in node-mongodb-native
PR description
Fix type for nested objects in query & update added in https://github.com/mongodb/node-mongodb-native/pull/3328
What is changing?
- Support union types (... extends unknown ? ... : never)
- Fail if path is wrong (never vs unknown)
- Support array operators in the middle of a path (number replaced by number | `$${'' | `[${string}]`}` and NestedPathsOfType removed)
What is the motivation for this change?
const _: MatchKeysAndValues<{ aaa: readonly { bbb: 'ccc' }[] }> = { 'aaa.$.bbb': 'ccc' }; // Error const _: MatchKeysAndValues<{ aaa: { bbb: { ccc: 'ddd'[] }[] }> = { 'aaa.$.bbb.$[arrayFilter]': 'ddd' }; // Error