TypeScript's type system lacks the expressiveness to programmatically transform Method<T> into Wrapper. You'd need to move the scope of the generic type parameter T around in ways that can't be done.
If TypeScript had generic values as requested in microsoft/TypeScript#17574, then you might be able to say something like:
// Invalid TypeScript, don't do this
interface Wrapper {
fn: forall T. Method<T>;
}
or
// Invalid TypeScript, don't do this
interface Wrapper {
fn: <T> Method<T>;
}
But it doesn't so we can't.
You can almost do it the other way around and define Method<T> in terms of Wrapper, using instantiation expressions. I say "almost" because it requires that you drop down to the type level and acquire (or pretend to acquire) a value wrapper of type Wrapper before lifting back up to the type level. Like this:
declare const wrapper: Wrapper; // pretend to have this
type Method<T> = typeof wrapper.fn<T> // instantiate fn with <T>
// type Method<T> = (a: T) => T
Depending on your use case that may or may not be helpful.
Playground link to code
MethodWrapper?interface MethodWrapper<T> {fn: Method<T>}Method<T>intoWrapperprogrammatically. You'd need something like generic values as requested in ms/TS#17574 to do that. But the type<T,>(a: T)=>booleanis unnecessarily generic anyway, it is equivalent to(a: unknown)=>booleanas shown here. Could you modify your example so that the generic is required (e.g.,<T,>(a: T) => T) like this? Once you do that I could write up an answer explaining why this isn't possible.