After successfully creating a helper type to unwrap the inner type of an Observable<T>
, I began wondering how to make this type completely generic. I wanted it to apply to any type, not just Observable, essentially creating Unwrap<T>
.
Here is my attempt:
type Unwrap<T, W> = T extends W<(infer U)> ? U : never;
However, I encountered the error message:
Type 'W' is not generic. ts(2315)
I am now seeking guidance on how to create a type that can unwrap any specified type.