Generic return type of function in record

I have a function with a param of type Foo<T> = <T extends string | number | symbol> = Record<T, (context: Context) => unknown> I'd like to keep the return type of whatever the function is. How would I use generics to get this to work?
1 Reply
benten
bentenOP3y ago
got it, it was so easy in hindsight
type Routes<T> = {
[P in keyof T]: (context: Context) => T[P];
}
type Routes<T> = {
[P in keyof T]: (context: Context) => T[P];
}
Want results from more Discord servers?
Add your server