-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptWorking as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Milestone
Description
TypeScript Version: 3.6.0-dev.20190719
Search Terms:
spread
type check
Code
// Error as expected, b2 is not a valid key
const foo: {a?: string; b?: string} = {
//a: "",
...{b2: ""}
}
// I meant to overwrite b, but somehow this is accepted
const bar: {a?: string; b?: string} = {
a: "",
...{b2: ""}
}
Expected behavior:
bar
should not accept ...{b2: ""}
Actual behavior:
bar
has type {a?: string; b?: string}
, but at runtime actually has extra property b2
Playground Link:
No problem v3.0.1
Regression v3.1.6
Related Issues:
#30129
mathieumg, a1300, micheleangioni, aakrem, aliashkevich and 7 more
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptWorking as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug