-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Bug Report
I'm have some issues with the last version of MongoDB node.js driver. There is now a type check on the queries filter/update (which is really great!) but some complex types require to bypass it..
Cf mongodb/node-mongodb-native#3328
🔎 Search Terms
record object template index indexes key
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about common bugs that aren't bugs
⏯ Playground Link
💻 Code
const o1: { [k1: `a.${number}`]: true } = { [`a.${Date.now()}`]: true } as const;
// => No error
const o2: { [k1: `a.${number}`]: true } = { [`a.${Date.now()}`]: true };
// => Type '{ [x: string]: boolean; }' is not assignable to type '{ [k1: `a.${number}`]: true; }'.
const o3: { [k1: `a.${number}`]: true, [k2: `b.${number}`]: false } = { [`a.${Date.now()}`]: true, 'b.0': false } as const;
// => Type '{ readonly [x: string]: boolean; readonly 'b.0': false; }' is not assignable to type '{ [k1: `a.${number}`]: true; [k2: `b.${number}`]: false; }'.
const o4: { [k1: `a.${number}`]: true, [k2: `b.${number}`]: false } = { [`a.${Date.now()}`]: true, 'b.0': false };
// => Type '{ [x: string]: boolean; 'b.0': false; }' is not assignable to type '{ [k1: `a.${number}`]: true; [k2: `b.${number}`]: false; }'.
🙁 Actual behavior
Errors with o3 and o4 declarations. I think o2 should work also.
🙂 Expected behavior
No errors.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created