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

Interface unions type checking #17256

Closed
jspri opened this issue Jul 18, 2017 · 2 comments
Closed

Interface unions type checking #17256

jspri opened this issue Jul 18, 2017 · 2 comments

Comments

@jspri
Copy link

jspri commented Jul 18, 2017

TypeScript Version: 2.4.0

Code

interface Foo {
  a: string;
}

interface Bar extends Foo {
  b: string;
  c: string;
}

// d is neither foo nor bar!
const d: Foo | Bar = {
  a: 'lol',
  b: 'kek',
};

Expected behavior:

You would expect the code above to throw an error as d can not be resolved to type foo or type bar.

Actual behavior:

Code compiles without error.

@jcalz
Copy link
Contributor

jcalz commented Jul 18, 2017

duplicate of #14383?

@jcalz jcalz marked this as a duplicate of #14383 Jul 18, 2017
@jspri
Copy link
Author

jspri commented Jul 18, 2017

Yeah, thanks.

@jspri jspri closed this as completed Jul 18, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants