-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 3.1.0-dev.20180808
Search Terms:
Code
const obj = {
foo: 1,
...{set bar(v: number) {}}
};
Expected behavior:
obj
is inferred as {foo: number, bar: undefined}
.
Spreading a setter-only property uses undefined
as the property's value.
Likewise the following evaluates to true
:
({
foo: 1,
...{set foo(v) {}}
}).foo === undefined;
Actual behavior:
obj
is inferred as {foo: number}
.
Playground Link: https://agentcooper.github.io/typescript-play/#code/MYewdgzgLgBCBGArGBeGBvAUDHMBmIIAXDAIwA02uAdLehAKazwCGATgBQBuJYArgFt4DNgEoMAXwmYJAbkxA
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue