-
Notifications
You must be signed in to change notification settings - Fork 13k
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.3.0-dev
Code
function test<T extends { a: string }>(obj: T) {
let { a, ...rest } = obj;
return { ...rest, b: a };
}
let o1 = { a: 'hello', x: 42 };
let o2: { b: string, x: number } = test(o1); // Error, but shouldn't be
Expected behavior:
No error.
Actual behavior:
Error as shown above.
Playground Link:
Related Issues:
Found while investigating #29062.
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