Skip to content

Commit

Permalink
reference and virtual types can't reference their own table type
Browse files Browse the repository at this point in the history
  • Loading branch information
kyscott18 committed Oct 30, 2023
1 parent e7d5ade commit a0e4848
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions packages/core/src/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,22 @@ export const createEnum = <TEnum extends Enum>(_enum: TEnum) => _enum;
*/
export const createSchema = <
const TSchema extends {
[schemaKey in keyof TSchema]:
[tableName in keyof TSchema]:
| Table<
{ id: NonReferenceColumn<ID, false, false> } & Record<
string,
| NonReferenceColumn
| ReferenceColumn<
Scalar,
`${keyof FilterTables<TSchema> & string}.id`
>
| EnumColumn<keyof FilterEnums<TSchema>, boolean>
| VirtualColumn<keyof FilterTables<TSchema>, string>
>
{ id: NonReferenceColumn<ID, false, false> } & {
[columnName in keyof TSchema[tableName]]:
| NonReferenceColumn
| ReferenceColumn<
Scalar,
`${Exclude<keyof FilterTables<TSchema>, tableName> &
string}.id`
>
| EnumColumn<keyof FilterEnums<TSchema>, boolean>
| VirtualColumn<
Exclude<keyof FilterTables<TSchema>, tableName>,
string
>;
}
>
| Enum<readonly string[]>;
}
Expand Down

0 comments on commit a0e4848

Please sign in to comment.