From 1fa8097e9db6d4ef7b716c8c26cc9201961a002f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Costa?= Date: Sun, 13 Oct 2024 12:42:42 -0700 Subject: [PATCH] Remove type dependencies on schema selector --- .changeset/stupid-pans-peel.md | 6 ++++++ packages/all/src/__tests__/effect.test.ts | 1 - packages/effect/src/__tests__/effect.test.ts | 1 - packages/main/src/__tests__/effect.test.ts | 1 - packages/main/src/selector.ts | 8 +++----- 5 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 .changeset/stupid-pans-peel.md diff --git a/.changeset/stupid-pans-peel.md b/.changeset/stupid-pans-peel.md new file mode 100644 index 0000000..474cd6d --- /dev/null +++ b/.changeset/stupid-pans-peel.md @@ -0,0 +1,6 @@ +--- +'@typeschema/main': minor +'@typeschema/all': patch +--- + +Remove type dependencies on schema selector diff --git a/packages/all/src/__tests__/effect.test.ts b/packages/all/src/__tests__/effect.test.ts index d38e44a..f4f263e 100644 --- a/packages/all/src/__tests__/effect.test.ts +++ b/packages/all/src/__tests__/effect.test.ts @@ -31,7 +31,6 @@ describe('effect', () => { name: Schema.String, updatedAt: DateFromString, }); - console.log(typeof schema); const data = readonly({ age: 123, diff --git a/packages/effect/src/__tests__/effect.test.ts b/packages/effect/src/__tests__/effect.test.ts index 9270a00..352ce9b 100644 --- a/packages/effect/src/__tests__/effect.test.ts +++ b/packages/effect/src/__tests__/effect.test.ts @@ -27,7 +27,6 @@ describe('effect', () => { name: Schema.String, updatedAt: DateFromString, }); - console.log(typeof schema); const data = readonly({ age: 123, diff --git a/packages/main/src/__tests__/effect.test.ts b/packages/main/src/__tests__/effect.test.ts index d38e44a..f4f263e 100644 --- a/packages/main/src/__tests__/effect.test.ts +++ b/packages/main/src/__tests__/effect.test.ts @@ -31,7 +31,6 @@ describe('effect', () => { name: Schema.String, updatedAt: DateFromString, }); - console.log(typeof schema); const data = readonly({ age: 123, diff --git a/packages/main/src/selector.ts b/packages/main/src/selector.ts index 9cb7990..1178d59 100644 --- a/packages/main/src/selector.ts +++ b/packages/main/src/selector.ts @@ -1,11 +1,10 @@ import type {AdapterResolvers} from './adapters'; import type {AdapterResolver} from './resolver'; -import type {IfDefined, SchemaFrom} from '@typeschema/core'; -import type {CoreValidator} from 'suretype'; +import type {SchemaFrom} from '@typeschema/core'; // prettier-ignore type IsTypeboxSchema = - TSchema extends {static: unknown, params: unknown[]} ? true + TSchema extends {static: unknown, params: unknown} ? true : false; function isTypeboxSchema( schema: SchemaFrom, @@ -15,8 +14,7 @@ function isTypeboxSchema( // prettier-ignore type IsSuretypeSchema = - [IfDefined>] extends [never] ? false - : TSchema extends CoreValidator ? true + TSchema extends {required: () => {constructor: unknown}} ? true : false; function isSuretypeSchema( schema: SchemaFrom,