'Can I pass a type as an argument to a generic when the type is an extension of enums?

If I have two enums:

export enum First {
   One = "One"
}
export enum Second {
   Two = "Two"
}

And I combine them into a type:

export type Combined = One | Two;

Is it ok to pass Combined like so:

export type FooType = Record<Combined, unknown>;


Solution 1:[1]

No reason it wouldn't work !

export enum First {
   One = "One"
}
export enum Second {
   Two = "Two"
}
export type Combined = First.One | Second.Two;

export type FooType = Record<Combined, unknown>;

Playground

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matthieu Riegler