Microsoft/TypeScript

Omitting a property from tuple breaks destruction

Open

#54.371 geöffnet am 24. Mai 2023

Auf GitHub ansehen
 (17 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
BugDomain: Mapped TypesHelp Wanted

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

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

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

Contributor Guide