-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
This is using the latest release-2.1 branch. I'm unclear why types B & C would behave differently below when it comes to object rest members, so I am assuming this is a bug. (ping @sandersn & @mhegazy ).
interface A {
name: string;
age: number;
}
interface B extends A {
address: string;
}
type C = A & {address: string};
// Both v1 & v2 appear to have the same members...
var v1: B;
var v2: C;
// ... and assignment in either direction is fine
v1 = v2; // OK
v2 = v1; // OK
// let {name, ...x2} = v1; // This line is valid (when uncommented)
let {name, ...x3} = v2; // This line gives the error: Rest types may only be created from object types.normalser
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