CompositionTypeSatisfiesEnum
Type Aliases
Section titled “Type Aliases”CompositionTypeSatisfiesEnum
Section titled “CompositionTypeSatisfiesEnum”CompositionTypeSatisfiesEnum<
T,Enum> =unknown
Defined in: packages/isaacscript-common/src/types/CompositionTypeSatisfiesEnum.ts:31
Helper type to validate that a union of interfaces with a field of type that is based on an
enum is complete.
For example:
enum ObjectiveType { FOO, BAR, BAZ,}
interface FooObjective { type: ObjectiveType.FOO; fooThing: number;}
interface BarObjective { type: ObjectiveType.BAR; barThing: string;}
type Objective = FooObjective | BarObjective;type _Test = CompositionTypeSatisfiesEnum<Objective, ObjectiveType>;In this example, Test would be flagged by TypeScript because Objective does not contain an
entry for BazObjective.
Type Parameters
Section titled “Type Parameters”T extends object
Enum extends T["type"]
