From a0e4848663f0a376f4ddf25e299026afbf609dc3 Mon Sep 17 00:00:00 2001 From: Kyle Scott Date: Sun, 29 Oct 2023 22:21:58 -0400 Subject: [PATCH] reference and virtual types can't reference their own table type --- packages/core/src/schema/schema.ts | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/core/src/schema/schema.ts b/packages/core/src/schema/schema.ts index f101b385d..cb1ca3c65 100644 --- a/packages/core/src/schema/schema.ts +++ b/packages/core/src/schema/schema.ts @@ -92,18 +92,22 @@ export const createEnum = (_enum: TEnum) => _enum; */ export const createSchema = < const TSchema extends { - [schemaKey in keyof TSchema]: + [tableName in keyof TSchema]: | Table< - { id: NonReferenceColumn } & Record< - string, - | NonReferenceColumn - | ReferenceColumn< - Scalar, - `${keyof FilterTables & string}.id` - > - | EnumColumn, boolean> - | VirtualColumn, string> - > + { id: NonReferenceColumn } & { + [columnName in keyof TSchema[tableName]]: + | NonReferenceColumn + | ReferenceColumn< + Scalar, + `${Exclude, tableName> & + string}.id` + > + | EnumColumn, boolean> + | VirtualColumn< + Exclude, tableName>, + string + >; + } > | Enum; }