From 90d18c2067ada108a0d536e842129652fdeacd06 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 20 Aug 2021 15:38:17 -0500 Subject: [PATCH 1/2] Fix TypeScript Plugin Codegen --- .../bindings/plugin-ts/templates/types-ts.mustache | 13 ++++++++++--- .../cases/bind/sanity/output/plugin-ts/types.ts | 12 +++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/schema/bind/src/bindings/plugin-ts/templates/types-ts.mustache b/packages/schema/bind/src/bindings/plugin-ts/templates/types-ts.mustache index 324356a397..e59ad3c74a 100644 --- a/packages/schema/bind/src/bindings/plugin-ts/templates/types-ts.mustache +++ b/packages/schema/bind/src/bindings/plugin-ts/templates/types-ts.mustache @@ -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}} @@ -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 /// diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts index aa6d977eea..51d08912d9 100644 --- a/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts +++ b/packages/test-cases/cases/bind/sanity/output/plugin-ts/types.ts @@ -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" @@ -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 /// From c102c0acde12da5ca86fa75429ae456466125d95 Mon Sep 17 00:00:00 2001 From: dOrgJelli Date: Fri, 20 Aug 2021 15:39:01 -0500 Subject: [PATCH 2/2] prep 0.0.1-prealpha.35 --- CHANGELOG.md | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb898192bc..d4ee25c0fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# Web3API 0.0.1-prealpha.35 +## Bugs +* `@web3api/schema-bind`: Fix TypeScript plugin enum bindings. + # Web3API 0.0.1-prealpha.34 ## Bugs * `@web3api/schema-bind`: Fix TypeScript enum bindings. diff --git a/VERSION b/VERSION index fd13539e0f..829ede87c3 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.1-prealpha.34 \ No newline at end of file +0.0.1-prealpha.35 \ No newline at end of file