Is it somehow possible to pass a type that accepts a generic to a generic type? (Hard to describe what I mean exactly, check out the examples)
type DecorateBar<B extends AnyBar> = {
log: (bar: B) => B
}
// What I am looking for
export type GenericBarDecorator<B extends Bars, Decorator> {
// @ts-ignore
[K in keyof B]: Decorator<B[K]>
}
const MyBars = {} as Bars
// @ts-ignore
type Usage = GenericBarDecorator<typeof MyBars, DecorateBar>
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.