microsoft / microsoft/TypeScript
Variable initializer omits an error on destructuring assignment
Open
Nobody has claimed this yet.
Bug
Domain: check: Control Flow
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.7.x-dev.20200213
Search Terms:
Code
const [[{ data: a }]] = [] as [Text[]] | []; // error
const [[{ data: b }] = []] = [] as [Text[]] | []; // no error
Expected behavior:
const [[{ data: a }]] = [] as [Text[]] | []; // error
const [[{ data: b }] = []] = [] as [Text[]] | []; // error
Actual behavior:
const [[{ data: a }]] = [] as [Text[]] | []; // error
const [[{ data: b }] = []] = [] as [Text[]] | []; // no error
Related Issues:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two destructuring assignments from the issue, using the linked Playground if useful, and compare the reported diagnostics. Trace the TypeScript type-checking path for destructuring assignments and add a regression test near the existing checker tests. Done means both examples report the expected error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100