-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
π Search Terms
rest parameters tuple array generic
π Version & Regression Information
I tried some versions from 3.3.3 to 5.2.2 and Nightly version γnone of them fixed this problem.
β― Playground Link
π» Code
type Replace<T extends [...any], A, B> = {
[K in keyof T]: T[K] extends A ? B : T[K];
};
type ReplaceParams<T extends [...any],A,B>=(...args:Replace<[number,number],A,B>)=>any;//is ok
type ReplaceParams1<ARRAY extends [...any],A,B>=(...args:Replace<ARRAY,A,B>)=>any;//failed A rest parameter must be of an array type.
type ReplaceParams2<T extends (...arg:any)=>any,A,B>=(...args:Replace<Parameters<T>,A,B>)=>any; //failed A rest parameter must be of an array type.
type Remapped<T extends [...any]> ={
[K in keyof T]:T[K]
}
type SimpleCase<T extends [...any]> = (...args:Remapped<T>)=>any;//failed A rest parameter must be of an array type.
π Actual behavior
this was happend at latest version 5.2.2
and in the next version still no fixed
π Expected behavior
quite sure tuple or array type can be passed to function rest pamaters. but remapped cant.this make replace certain type in parameters inpossible.
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created