Microsoft/TypeScript
GitHub ã§èŠãUnion tuple type in rest argument can't accpect less argument.
Open
#48,663 opened on 2022幎4æ13æ¥
BugDomain: check: Variance RelationshipsHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
Bug Report
ð Search Terms
source has but target allows only
ð Version & Regression Information
- This is a crash
⯠Playground Link
Playground link with relevant code
ð» Code
const func: (...args: [number, string] | [string, number]) => void = (item) => { }
ð Actual behavior
throw error
Type '(item: string | number) => void' is not assignable to type '(...args: [number, string] | [string, number]) => void'.
Types of parameters 'item' and 'args' are incompatible.
Type '[number, string] | [string, number]' is not assignable to type '[item: string | number]'.
Type '[number, string]' is not assignable to type '[item: string | number]'.
Source has 2 element(s) but target allows only 1.
ð Expected behavior
no error