As a newcomer to TypeScript, I am currently exploring the use of generic type parameters. I have encountered an error message: '?' expected
while working on a function and a type that both require type arguments. The issue seems to be in the
InputProps<T, K extends keyof T>
section of the function.
type InputProps<T, K extends keyof T> = {
value: T[K]
}
function Input <T, K extends keyof T>({ value } : InputProps<T, K extends keyof T>) : void {
console.log(value);
}
https://i.sstatic.net/HlimC.png
I'm puzzled as to why it is expecting that portion to be a conditional statement. Despite my efforts to search for an explanation, I haven't been able to find a solution. Could someone clarify this for me?