I would like to use unknown over any in AppendArgument. Because I would prefer not to get past type checking using any.
typeAppendArgument<Fextends(...args:unknown[])=>unknown,A>=(x:A,...args:Parameters<F>)=>ReturnType<F>;typeFinalF=AppendArgument<(a:number,b:string)=>number,boolean>;// this gives an error since the function parameters cannot be mapped to `unknown`
I am Software Developer, currently interested in static type languages (TypeScript, Elm, ReScript) mostly in the frontend land, but working actively in Python also. I am available for mentoring.
Extends any[] doesn't mean it is any[] it only means it is any array, so array with any type you want. Compiler will infer correct type and it will never be any. There is no type whole here
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I would like to use
unknown
overany
inAppendArgument
. Because I would prefer not to get past type checking usingany
.Any ideas of how I can change this?
Extends any[] doesn't mean it is any[] it only means it is any array, so array with any type you want. Compiler will infer correct type and it will never be any. There is no type whole here