Skip to content

Commit

Permalink
Fix TypeScript Plugin Codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
dOrgJelli committed Aug 20, 2021
1 parent 76eadb4 commit 90d18c2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ export interface {{type}} {

{{/objectTypes}}
{{#enumTypes}}
enum {{type}}Enum {
export enum {{type}}Enum {
{{#constants}}
{{.}},
{{/constants}}
}

type {{type}}String =
export type {{type}}String =
{{#constants}}
| "{{.}}"
{{/constants}}
Expand All @@ -55,12 +55,19 @@ export interface {{type}} {
{{/importedObjectTypes}}
{{#importedEnumTypes}}
/* URI: "{{uri}}" */
export enum {{type}} {
export enum {{type}}Enum {
{{#constants}}
{{.}},
{{/constants}}
}

export type {{type}}String =
{{#constants}}
| "{{.}}"
{{/constants}}

export type {{type}} = {{type}}Enum | {{type}}String;

{{/importedEnumTypes}}
/// Imported Objects END ///

Expand Down
12 changes: 9 additions & 3 deletions packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ export interface AnotherType {
circular?: Types.CustomType | null;
}

enum CustomEnumEnum {
export enum CustomEnumEnum {
STRING,
BYTES,
}

type CustomEnumString =
export type CustomEnumString =
| "STRING"
| "BYTES"

Expand All @@ -91,11 +91,17 @@ export interface TestImport_AnotherObject {
}

/* URI: "testimport.uri.eth" */
export enum TestImport_Enum {
export enum TestImport_EnumEnum {
STRING,
BYTES,
}

export type TestImport_EnumString =
| "STRING"
| "BYTES"

export type TestImport_Enum = TestImport_EnumEnum | TestImport_EnumString;

/// Imported Objects END ///

/// Imported Queries START ///
Expand Down

0 comments on commit 90d18c2

Please sign in to comment.