Skip to content

Wrong report of TS2525 #21634

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

Closed
tibor19 opened this issue Feb 5, 2018 · 1 comment
Closed

Wrong report of TS2525 #21634

tibor19 opened this issue Feb 5, 2018 · 1 comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@tibor19
Copy link

tibor19 commented Feb 5, 2018

TypeScript Version: 2.8.0-dev.20180204

Search Terms:
TS2525 "Initializer provides no value for this binding element and the binding element has no default value"
Code

const [, a, b] = [, , ];

// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.

Expected behavior:
Should compile without errors
Actual behavior:
Reports error TS2525. Adding an extra comma, makes the message go away.

const [, a, b] = [, , ,]; 

Playground Link:

Related Issues:

@RyanCavanaugh RyanCavanaugh added the Working as Intended The behavior described is the intended behavior; this is not a bug label Feb 5, 2018
@RyanCavanaugh
Copy link
Member

Trailing commas in array literals don't create an empty element. [ , , ] has length 2, not 3.

@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

2 participants