From 0ed13d02bb71b5bf1d3d2c3730628b8999b7510e Mon Sep 17 00:00:00 2001 From: "Marcus S. Abildskov" <8391194+marcus-sa@users.noreply.github.com> Date: Sun, 1 Oct 2023 18:53:53 +0200 Subject: [PATCH] fix(type): ensure both types have names before comparing in isSameType function (#474) * fix(type): ensure types have names before comparing in isSameType function Fixes failing `basic union with number | uuid` test in bson package * ci: bump nodejs version --- .github/workflows/main.yml | 10 +++++----- packages/type/src/reflection/type.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b531229d9..65c2f584c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ jobs: runs-on: buildjet-2vcpu-ubuntu-2004 strategy: matrix: - node-version: [ 18.x ] + node-version: [18.17.0] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} @@ -97,7 +97,7 @@ jobs: runs-on: buildjet-2vcpu-ubuntu-2004 strategy: matrix: - node-version: [ 18.x ] + node-version: [18.17.0] postgres-version: [ 14 ] services: postgres: @@ -145,7 +145,7 @@ jobs: runs-on: buildjet-2vcpu-ubuntu-2004 strategy: matrix: - node-version: [ 18.x ] + node-version: [18.17.0] mysql-version: [ 8.0 ] services: mysql: @@ -192,7 +192,7 @@ jobs: runs-on: buildjet-2vcpu-ubuntu-2004 strategy: matrix: - node-version: [ 18.x ] + node-version: [18.17.0] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} @@ -229,7 +229,7 @@ jobs: runs-on: buildjet-2vcpu-ubuntu-2004 strategy: matrix: - node-version: [ 18.x ] + node-version: [18.17.0] mongo-version: [ 4.0 ] services: # this is used for the simple-auth test diff --git a/packages/type/src/reflection/type.ts b/packages/type/src/reflection/type.ts index a698f2edf..730389bba 100644 --- a/packages/type/src/reflection/type.ts +++ b/packages/type/src/reflection/type.ts @@ -601,7 +601,7 @@ export function isSameType(a: Type, b: Type, stack: StackEntry[] = []): boolean try { if (a.kind !== b.kind) return false; - if (a.typeName !== b.typeName) return false; + if (a.typeName && b.typeName && a.typeName !== b.typeName) return false; if (a.kind === ReflectionKind.infer || b.kind === ReflectionKind.infer) return false; if (a.kind === ReflectionKind.literal) return a.literal === (b as TypeLiteral).literal;