Skip to content

Commit

Permalink
Fix #1297
Browse files Browse the repository at this point in the history
  • Loading branch information
osyrisrblx committed Aug 30, 2024
1 parent 54d6de3 commit ea01411
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/class/EnumGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export class EnumGenerator extends Generator {
this.write(`interface Enum {`);
this.pushIndent();
this.write(`GetEnumItems(this: Enum): Array<EnumItem>;`);
this.write(`FromName(this: Enum, name: string): EnumItem | undefined;`);
this.write(`FromValue(this: Enum, value: number): EnumItem | undefined;`);
this.popIndent();
this.write(`}`);
this.write(``);
Expand Down Expand Up @@ -71,6 +73,12 @@ export class EnumGenerator extends Generator {
this.write(``);
}
this.write(`export function GetEnumItems(this: globalThis.Enum): Array<globalThis.Enum.${enumTypeName}>;`);
this.write(
`export function FromName(this: globalThis.Enum, name: string): globalThis.Enum.${enumTypeName} | undefined;`,
);
this.write(
`export function FromValue(this: globalThis.Enum, value: number): globalThis.Enum.${enumTypeName} | undefined;`,
);
this.popIndent();
this.write(`}`);
const enumUnion =
Expand Down

0 comments on commit ea01411

Please sign in to comment.