Open
Description
Bug Report
🔎 Search Terms
exactOptionalPropertyTypes
strictoptionalProperties
Partial
index signature dictionary record
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about
exactOptionalPropertyTypes
⏯ Playground Link
Playground link with relevant code
💻 Code
type MyRecord = { x: string; z: string };
const r: Partial<MyRecord> = {
x: "y",
// Error as expected ✅
z: undefined,
};
type MyDict = { [key: string]: string };
const d: Partial<MyDict> = {
x: "y",
// Expected error but got none ❌
z: undefined,
};
🙁 Actual behavior
See code comments above.
🙂 Expected behavior
See code comments above.
This was briefly discussed in #44524 and #44421 (comment).