Skip to content

Commit

Permalink
refactor(core): use TypeAnnotation instead of manually specifying met…
Browse files Browse the repository at this point in the history
…a field
  • Loading branch information
marcus-sa committed Nov 28, 2023
1 parent 186066a commit 6dc0554
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/core/src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import { ClassType, AbstractClassType } from '@deepkit/core';
import { TypeAnnotation } from '@deepkit/type';

export type GraphQLFields<T> = Record<string, { readonly type: T }>;

export const PARENT_META_NAME = 'parent';

// eslint-disable-next-line functional/prefer-readonly-type
export type Parent<T> = T & { __meta?: [typeof PARENT_META_NAME, T] };
export type Parent<T> = T & TypeAnnotation<typeof PARENT_META_NAME, T>;

export const CONTEXT_META_NAME = 'context';

// eslint-disable-next-line functional/prefer-readonly-type
export type Context<T> = T & { __meta?: [typeof CONTEXT_META_NAME, T] };
export type Context<T> = T & TypeAnnotation<typeof CONTEXT_META_NAME, T>;

// eslint-disable-next-line @typescript-eslint/ban-types
export type Instance<T = any> = T & {
Expand Down

0 comments on commit 6dc0554

Please sign in to comment.