import type { Args } from './Args.js' import type { MaybeThunk } from './core/helpers.js' import type { Hybrid } from './Hybrid/__.js' import type { Output } from './Output/__.js' export type Field<$Type extends Output.Any, $Args extends Args | null> = { type: $Type args: $Args } export const field = <$Type extends Output.Any, $Args extends null | Args = null>( type: MaybeThunk<$Type>, args: $Args = null as $Args, ): Field<$Type, $Args> => { return { // At type level "type" is not a thunk type: type as any, // eslint-disable-line args, } } // todo test non null interface fields export type SomeField = Field< | Hybrid.Enum | Hybrid.Scalar.Any | Output.List | Output.Nullable | Output.Object$2 | Output.Union | Output.Interface | null>>, [any, ...any[]]>, Args | null > export type SomeFields<$Keys extends string | number | symbol = string | number | symbol> = Record< $Keys, SomeField >