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

Suggestion: Tuple literal may only specify known properties #12308

Closed
ghost opened this issue Nov 16, 2016 · 2 comments
Closed

Suggestion: Tuple literal may only specify known properties #12308

ghost opened this issue Nov 16, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@ghost
Copy link

ghost commented Nov 16, 2016

TypeScript Version: nightly (2.2.0-dev.20161116)

Code

const p1: { x: number, y: number } = { x: 0, y: 1, z: 2 };
const p2: [number, number] = [0, 1, 2];

Expected behavior:

Errors on both lines.

Actual behavior:

Only the first line has an error.

@mhegazy mhegazy added Suggestion An idea for TypeScript In Discussion Not yet reached consensus labels Apr 27, 2017
@mhegazy
Copy link
Contributor

mhegazy commented Apr 27, 2017

looks like a duplicate of #6229

@mhegazy mhegazy closed this as completed Apr 27, 2017
@mhegazy mhegazy added Duplicate An existing issue was already created and removed In Discussion Not yet reached consensus Suggestion An idea for TypeScript labels Apr 27, 2017
@ghost
Copy link
Author

ghost commented May 1, 2017

I don't know -- even if using a non-exact tuple type, it still seems like it would be useful to report an error in the case of a tuple literal with an extra property. Similar to the relationship between object excess property checking and exact types (#12936).

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

1 participant