From 14b4e3c885dd34abcc885d8b76ef2d857db55e3c Mon Sep 17 00:00:00 2001 From: Arthur Fiorette Date: Mon, 1 Jul 2024 10:05:56 -0300 Subject: [PATCH] code --- src/Error/Errors.ts | 2 +- src/SchemaGenerator.ts | 4 ++-- test/valid-data-other.test.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Error/Errors.ts b/src/Error/Errors.ts index d0c11f80c..2d0413082 100644 --- a/src/Error/Errors.ts +++ b/src/Error/Errors.ts @@ -17,7 +17,7 @@ export class UnknownTypeError extends BaseError { constructor(readonly type: BaseType) { super({ code: 101, - messageText: `Unknown type "${type.getId()}"`, + messageText: `Unknown type "${type?.getId()}"`, }); } } diff --git a/src/SchemaGenerator.ts b/src/SchemaGenerator.ts index 9ea6d2cf0..910edc3f3 100644 --- a/src/SchemaGenerator.ts +++ b/src/SchemaGenerator.ts @@ -166,8 +166,8 @@ export class SchemaGenerator { ts.isTypeAliasDeclaration(node) ) { if ( - this.config?.expose === "all" || - (this.isExportType(node) && !this.isGenericType(node as ts.TypeAliasDeclaration)) + (this.config?.expose === "all" || this.isExportType(node)) && + !this.isGenericType(node as ts.TypeAliasDeclaration) ) { allTypes.set(this.getFullName(node, typeChecker), node); return; diff --git a/test/valid-data-other.test.ts b/test/valid-data-other.test.ts index 08cec2cb6..2b6ddd181 100644 --- a/test/valid-data-other.test.ts +++ b/test/valid-data-other.test.ts @@ -43,6 +43,7 @@ describe("valid-data-other", () => { it("import-anonymous", assertValidSchema("import-anonymous", "MyObject")); it("generic-simple", assertValidSchema("generic-simple", "MyObject")); + it("generic-simple", assertValidSchema("generic-simple", "*", { expose: "all" })); it("generic-arrays", assertValidSchema("generic-arrays", "MyObject")); it("generic-multiple", assertValidSchema("generic-multiple", "MyObject")); it("generic-multiargs", assertValidSchema("generic-multiargs", "MyObject"));