Microsoft/TypeScript
GitHub ã§èŠãOmitting a property from tuple breaks destruction
Open
#54,371 opened on 2023幎5æ24æ¥
BugDomain: Mapped TypesHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
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