import * as api from '../src' ; { type Context = unknown ; const t = api . createTypesFactory < Context > ( ) ; type Human = { id : string ; age : number ; friendIds : Array < string > ; } ; t . objectType < Human > ( { name : 'Human' , fields : ( ) => [ t . field ( { name : 'id' , type : t . String , } ) , t . field ( { name : 'name' , type : t . String , } ) , t . field ( { name : 'name' , type : t . String , resolve : ( ) => 'Anonym' , } ) , t . field ( { name : 'age' , type : t . String , } ) , t . field ( { name : 'age' , type : t . String , resolve : ( source ) => String ( source . age ) , } ) , t . field ( { name : 'friendIds' , type : t . List ( t . ID ) , } ) , ] , } ) ; } { const t = api . createTypesFactory < unknown > ( ) ; type Human = { id : string ; age : number ; friendIds : Array < string > ; } ; const GraphQLHuman = t . objectType < Human > ( { name : 'Human' , fields : ( ) => [ t . field ( { name : 'id' , type : t . String , } ) , ] , } ) ; t . objectType < Array < Human > > ( { name : 'HumanConnection' , fields : ( ) => [ t . field ( { name : 'edges' , type : t . List ( t . NonNull ( GraphQLHuman ) ) , resolve : ( value ) => value , } ) , ] , } ) ; t . objectType < Array < Human > > ( { name : 'HumanConnection' , fields : ( ) => [ t . field ( { name : 'edges' , type : t . NonNull ( t . List ( t . NonNull ( GraphQLHuman ) ) ) , resolve : ( value ) => value , } ) , ] , } ) ; } { type User = { id : string ; name : string ; } ; type Context = unknown ; const t = api . createTypesFactory < Context > ( ) ; const GraphQLUserType = t . objectType < User > ( { name : 'User' , fields : ( ) => [ t . field ( { name : 'id' , type : t . NonNull ( t . ID ) } ) , t . field ( { name : 'name' , type : t . NonNull ( t . String ) } ) , t . field ( { name : 'parent' , type : GraphQLUserType , resolve : ( ) => { return 5 ; } , } ) , ] , } ) ; const GraphQLUserType1 = t . objectType < User > ( { name : 'User' , fields : ( ) => [ t . field ( { name : 'id' , type : t . NonNull ( t . ID ) } ) , t . field ( { name : 'name' , type : t . NonNull ( t . String ) } ) , t . field ( { name : 'parent' , type : GraphQLUserType1 , resolve : ( ) => { return 5 ; } , } ) , ] , } ) ; const GraphQLUserType2 = t . objectType < User > ( { name : 'User' , fields : ( ) => [ t . field ( { name : 'id' , type : t . NonNull ( t . ID ) } ) , t . field ( { name : 'name' , type : t . NonNull ( t . String ) } ) , t . field ( { name : 'parent' , type : GraphQLUserType2 , resolve : ( ) => { return { id : '1' , name : 'Peter' } ; } , } ) , ] , } ) ; } { type Context = unknown ; const t = api . createTypesFactory < Context > ( ) ; t . subscriptionField ( { name : 'foo' , type : t . Boolean , subscribe : async function * ( ) { yield true ; } , } ) ; t . subscriptionField ( { name : 'foo' , type : t . Boolean , subscribe : async function * ( ) { yield { foo : true } ; } , } ) ; t . subscriptionField ( { name : 'foo' , type : t . Boolean , subscribe : async function * ( ) { yield { foo : 'true' } ; } , } ) ; } { const t = api . createTypesFactory < unknown > ( ) ; t . field ( { name : 'foo' , type : t . Boolean , args : { foo : t . arg ( t . Boolean ) , } , resolve : ( _ , args ) => { if ( args . foo === undefined ) { const _value = args . foo ; console . log ( _value ) ; } if ( args . foo === true ) { const _value = args . foo ; console . log ( _value ) ; } if ( args . foo === null ) { const _value = args . foo ; console . log ( _value ) ; } return true ; } , } ) ; } { const t = api . createTypesFactory < unknown > ( ) ; t . objectType ( { name : 'Foo' , fields : ( ) => [ ] , } ) ; t . mutationType ( { name : 'Foo' , fields : ( ) => [ ] , } ) ; t . queryType ( { name : 'Foo' , fields : ( ) => [ ] , } ) ; t . subscriptionType ( { name : 'Foo' , fields : ( ) => [ ] , } ) ; }