Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spread on object breaks assignability check #15029

Closed
wclr opened this issue Apr 5, 2017 · 3 comments
Closed

Spread on object breaks assignability check #15029

wclr opened this issue Apr 5, 2017 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@wclr
Copy link

wclr commented Apr 5, 2017

Didn't find an issue on this.

TypeScript Version: 2.2.2

Code

type A = {
  a: string,
  b: string
}

let a: A = {
  a: '1', b: '2', c: 3,
  ...{ x: 1 } // no error
} 

Expected behavior:
I would expect TS Error like in this case

type A = {
  a: string,
  b: string
}

let a: A = {
  a: '1', b: '2', c: 3 // error: Object literal may only specify known properties, and 'c' does not exist in type 'A'
} 

Actual behavior:
No error

@RyanCavanaugh
Copy link
Member

See #12745

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Apr 5, 2017
@wclr
Copy link
Author

wclr commented Apr 5, 2017

@RyanCavanaugh what spread has to do with unions?

@RyanCavanaugh
Copy link
Member

Oops, #13878

@sandersn sandersn closed this as completed Apr 5, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants