Skip to content

Commit

Permalink
Ensure up-to-date types for link fields (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
leo authored Feb 17, 2025
1 parent d35ce27 commit 6a7f64c
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/schema/primitives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,9 @@ type TypeToTSType<Type> = Type extends 'string'
: object;

type FieldInput<Type extends ModelField['type']> = Partial<
Omit<ModelField, keyof ModelFieldExpressions<TypeToTSType<Type>>> & {
type: 'link';
target: string;
kind?: 'one' | 'many';
actions?: {
onDelete?: 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'NO ACTION';
onUpdate?: 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'NO ACTION';
};
} & ModelFieldExpressions<TypeToTSType<Type>>
Omit<ModelField, keyof ModelFieldExpressions<TypeToTSType<Type>>> &
Extract<ModelField, { type: 'link' }> &
ModelFieldExpressions<TypeToTSType<Type>>
>;

export type FieldOutput<Type extends ModelField['type']> = Omit<
Expand Down

0 comments on commit 6a7f64c

Please sign in to comment.