|
|
|
|
|
by sirmarksalot
1236 days ago
|
|
This is technically correct, but I suspect it's pretty rare that you would choose "unknown" over a generic parameter. Even if you're writing an algorithm that doesn't care about the data type, it's still probably going to be used by application code that does care, and you'll want to support that need by passing the type through, otherwise the application will be forced to downcast. |
|
type Output<Fn> = Fn extends ((a: unknown) => infer Out) ? Out : never;