Microsoft/TypeScript
Voir sur GitHubOmitting a property from tuple breaks destruction
Open
#54 371 ouverte le 24 mai 2023
BugDomain: Mapped TypesHelp Wanted
Métriques du dépôt
- Stars
- (48 455 stars)
- Métriques de merge PR
- (Merge moyen 6j 17h) (9 PRs mergées en 30 j)
Description
Bug Report
🔎 Search Terms
tuple omit property
Searched in Bing and Github issues but I found nothing
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
💻 Code
const foo = [1, "2"] as const
const [a, b] = foo // everything works well, a is number and b is string
const bar = [1, "2"] as Omit<[number, string], "at">
const [c, d] = bar // Oops! c and d are string | number now
🙁 Actual behavior
↑
c and d are both string | number
🙂 Expected behavior
a and b should have correct type