INNER CODE UNIT · TypeScript
GInput
stepci/garph · src/index.ts:205
class GInput<N extends string, T extends AnyTypes> extends Type<T, 'InputType'> {
declare _name: N
constructor(name: string, shape: T, extend?: AnyTypes[]) {
super()
this.typeDef = {
name,
type: 'InputType',
shape,
extend
}
}
extend<D extends AnyTypes>(ref: D | D[]) {
// This is temporary construct, until we figure out how to properly manage to shared schema
this.typeDef.extend = Array.isArray(ref) ? ref : [ref]
return new GInput<N, T & UnionToIntersection<D>>(this.typeDef.name, this.typeDef.shape as any, Array.isArray(ref) ? ref : [ref])
}