diff --git a/packages/graphqlgen/src/generators/common.spec.ts b/packages/graphqlgen/src/generators/common.spec.ts index 03ccadcc..7935b95e 100644 --- a/packages/graphqlgen/src/generators/common.spec.ts +++ b/packages/graphqlgen/src/generators/common.spec.ts @@ -41,6 +41,7 @@ it('getDistinctInputTypes', () => { isUnion: false, isRequired: false, isArray: false, + isArrayRequired: false, }, }, { @@ -56,6 +57,7 @@ it('getDistinctInputTypes', () => { isUnion: false, isRequired: false, isArray: false, + isArrayRequired: false, }, }, ], @@ -85,6 +87,7 @@ it('getDistinctInputTypes', () => { isUnion: false, isRequired: false, isArray: false, + isArrayRequired: false, }, }, ], @@ -114,6 +117,7 @@ it('getDistinctInputTypes', () => { isUnion: false, isRequired: false, isArray: false, + isArrayRequired: false, }, }, ], @@ -143,6 +147,7 @@ it('getDistinctInputTypes', () => { isUnion: false, isRequired: false, isArray: false, + isArrayRequired: false, }, }, ], diff --git a/packages/graphqlgen/src/generators/common.ts b/packages/graphqlgen/src/generators/common.ts index 7c2e1a73..6b9cea88 100644 --- a/packages/graphqlgen/src/generators/common.ts +++ b/packages/graphqlgen/src/generators/common.ts @@ -188,29 +188,88 @@ export function shouldScaffoldFieldResolver( return !shouldRenderDefaultResolver(graphQLField, modelField, args) } -export function printFieldLikeType( +const nullable = (type: string): string => { + return `${type} | null` +} + +const kv = ( + key: string, + value: string, + isOptional: boolean = false, +): string => { + return `${key}${isOptional ? '?' : ''}: ${value}` +} + +const array = (innerType: string, config: { innerUnion?: boolean } = {}) => { + return config.innerUnion ? `${innerType}[]` : `Array<${innerType}>` +} + +type FieldPrintOptions = { + isReturn?: boolean +} + +export const printFieldLikeType = ( field: GraphQLTypeField, modelMap: ModelMap, -) { - const isNullable = - field.defaultValue === null || - (!field.type.isRequired && field.defaultValue === undefined) - - if (field.type.isScalar) { - return `${getTypeFromGraphQLType(field.type.name)}${ - field.type.isArray ? '[]' : '' - }${isNullable ? '| null' : ''}` + options: FieldPrintOptions = { + isReturn: false, + }, +): string => { + const name = field.type.isScalar + ? getTypeFromGraphQLType(field.type.name) + : field.type.isInput || field.type.isEnum + ? field.type.name + : getModelName(field.type, modelMap) + + /** + * Considerable difference between types in array versus not, such as what + * default value means, isRequired, ..., lead to forking the rendering paths. + * + * Regarding voidable, note how it can only show up in the k:v rendering e.g.: + * + * foo?: null | string + * + * but not for return style e.g.: + * + * undefined | null | string + * + * given footnote 1 below. + * + * 1. Return type doesn't permit void return since that would allow + * resolvers to e.g. forget to return anything and that be considered OK. + */ + + if (field.type.isArray) { + const innerUnion = field.type.isRequired + + // - Not voidable here because a void array member is not possible + // - For arrays default value does not apply to inner value + const valueInnerType = field.type.isRequired ? name : nullable(name) + + const isArrayNullable = + !field.type.isArrayRequired && + (field.defaultValue === undefined || field.defaultValue === null) + + const isArrayVoidable = isArrayNullable && field.defaultValue === undefined + + const valueType = isArrayNullable + ? nullable(array(valueInnerType, { innerUnion })) // [1] + : array(valueInnerType, { innerUnion }) + + return options.isReturn + ? valueType + : kv(field.name, valueType, isArrayVoidable) + } else { + const isNullable = + !field.type.isRequired && + (field.defaultValue === undefined || field.defaultValue === null) + + const isVoidable = isNullable && field.defaultValue === undefined + + const valueType = isNullable ? nullable(name) : name // [1] + + return options.isReturn ? valueType : kv(field.name, valueType, isVoidable) } - - if (field.type.isInput || field.type.isEnum) { - return `${field.type.name}${field.type.isArray ? '[]' : ''}${ - isNullable ? '| null' : '' - }` - } - - return `${getModelName(field.type, modelMap)}${ - field.type.isArray ? '[]' : '' - }${isNullable ? '| null' : ''}` } export function getTypeFromGraphQLType( diff --git a/packages/graphqlgen/src/generators/flow-generator.ts b/packages/graphqlgen/src/generators/flow-generator.ts index 3c733b7c..fed9c3bf 100644 --- a/packages/graphqlgen/src/generators/flow-generator.ts +++ b/packages/graphqlgen/src/generators/flow-generator.ts @@ -170,8 +170,8 @@ function renderInputTypeInterfaces( return `export interface ${upperFirst(type.name)}_${upperFirst( inputTypesMap[typeAssociation].name, )} { - ${inputTypesMap[typeAssociation].fields.map( - field => `${field.name}: ${printFieldLikeType(field, modelMap)}`, + ${inputTypesMap[typeAssociation].fields.map(field => + printFieldLikeType(field, modelMap), )} }` }) @@ -199,12 +199,11 @@ function renderInputArgInterface( return ` export interface ${getInputArgName(type, field)} { ${field.arguments - .map( - arg => - `${arg.name}: ${getArgTypePrefix(type, arg)}${printFieldLikeType( - arg as GraphQLTypeField, - modelMap, - )}`, + .map(arg => + printFieldLikeType(arg as GraphQLTypeField, modelMap).replace( + ': ', + `: ${getArgTypePrefix(type, arg)}`, + ), ) .join(',' + os.EOL)} } @@ -254,7 +253,10 @@ function renderResolverFunctionInterface( info: GraphQLResolveInfo, ) ` - const returnType = printFieldLikeType(field, modelMap) + + const returnType = printFieldLikeType(field, modelMap, { + isReturn: true, + }) if (type.name === 'Subscription') { return ` @@ -299,7 +301,9 @@ function renderResolverTypeInterfaceFunction( ctx: ${getContextName(context)}, info: GraphQLResolveInfo, )` - const returnType = printFieldLikeType(field, modelMap) + const returnType = printFieldLikeType(field, modelMap, { + isReturn: true, + }) if (type.name === 'Subscription') { return ` diff --git a/packages/graphqlgen/src/generators/ts-generator.ts b/packages/graphqlgen/src/generators/ts-generator.ts index 02ff90b7..ff234d94 100644 --- a/packages/graphqlgen/src/generators/ts-generator.ts +++ b/packages/graphqlgen/src/generators/ts-generator.ts @@ -194,8 +194,8 @@ function renderInputTypeInterfaces( return getDistinctInputTypes(type, typeToInputTypeAssociation, inputTypesMap) .map(typeAssociation => { return `export interface ${inputTypesMap[typeAssociation].name} { - ${inputTypesMap[typeAssociation].fields.map( - field => `${field.name}: ${printFieldLikeType(field, modelMap)}`, + ${inputTypesMap[typeAssociation].fields.map(field => + printFieldLikeType(field, modelMap), )} }` }) @@ -222,13 +222,7 @@ function renderInputArgInterface( return ` export interface Args${upperFirst(field.name)} { ${field.arguments - .map( - arg => - `${arg.name}: ${printFieldLikeType( - arg as GraphQLTypeField, - modelMap, - )}`, - ) + .map(arg => printFieldLikeType(arg as GraphQLTypeField, modelMap)) .join(os.EOL)} } ` @@ -263,7 +257,8 @@ function renderResolverFunctionInterface( info: GraphQLResolveInfo, ) ` - const returnType = printFieldLikeType(field, modelMap) + + const returnType = printFieldLikeType(field, modelMap, { isReturn: true }) if (type.name === 'Subscription') { return ` @@ -311,7 +306,7 @@ function renderResolverTypeInterfaceFunction( info: GraphQLResolveInfo, ) ` - const returnType = printFieldLikeType(field, modelMap) + const returnType = printFieldLikeType(field, modelMap, { isReturn: true }) if (type.name === 'Subscription') { return ` diff --git a/packages/graphqlgen/src/source-helper.ts b/packages/graphqlgen/src/source-helper.ts index 5e51cda0..e383f663 100644 --- a/packages/graphqlgen/src/source-helper.ts +++ b/packages/graphqlgen/src/source-helper.ts @@ -46,6 +46,7 @@ type GraphQLTypeDefinition = { export type GraphQLType = GraphQLTypeDefinition & { isArray: boolean + isArrayRequired: boolean isRequired: boolean } @@ -83,6 +84,7 @@ export type GraphQLUnionObject = { interface FinalType { isRequired: boolean isArray: boolean + isArrayRequired: boolean type: GraphQLInputType | GraphQLOutputType } @@ -130,13 +132,20 @@ function extractTypeDefinition( const getFinalType = ( type: GraphQLInputType | GraphQLOutputType, - acc: FinalType = { isArray: false, isRequired: false, type }, + acc: FinalType = { + isArray: false, + isArrayRequired: false, + isRequired: false, + type, + }, ): FinalType => { if (type instanceof GraphQLNonNull) { acc.isRequired = true } if (type instanceof GraphQLList) { acc.isArray = true + acc.isArrayRequired = acc.isRequired + acc.isRequired = false } if (type instanceof GraphQLNonNull || type instanceof GraphQLList) { @@ -157,13 +166,21 @@ function extractTypeLike( type: GraphQLInputType | GraphQLOutputType, ): GraphQLType { const typeLike: GraphQLType = {} as GraphQLType - const { isArray, isRequired, type: finalType } = getFinalType(type) + const { + isArray, + isArrayRequired, + isRequired, + type: finalType, + } = getFinalType(type) if (isRequired) { typeLike.isRequired = true } if (isArray) { typeLike.isArray = true } + if (isArrayRequired) { + typeLike.isArrayRequired = true + } if ( finalType instanceof GraphQLObjectType || finalType instanceof GraphQLInterfaceType || diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap index 7871fa13..c8554af3 100644 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/basic.test.ts.snap @@ -324,14 +324,14 @@ export type Query_Custom_array_nullable_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => Number[] | null | Promise; +) => Array | null | Promise | null>; export type Query_Custom_array_required_Resolver = ( parent: {}, args: {}, ctx: Context, info: GraphQLResolveInfo -) => Number[] | Promise; +) => Array | Promise>; export type Query_Custom_with_arg_Resolver = ( parent: {}, @@ -366,14 +366,14 @@ export type Query_Scalar_array_nullable_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => boolean[] | null | Promise; +) => Array | null | Promise | null>; export type Query_Scalar_array_required_Resolver = ( parent: {}, args: {}, ctx: Context, info: GraphQLResolveInfo -) => boolean[] | Promise; +) => Array | Promise>; export type Query_Scalar_with_arg_Resolver = ( parent: {}, @@ -416,14 +416,14 @@ export interface Query_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | null | Promise; + ) => Array | null | Promise | null>; custom_array_required: ( parent: {}, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | Promise; + ) => Array | Promise>; custom_with_arg: ( parent: {}, @@ -458,14 +458,14 @@ export interface Query_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | null | Promise; + ) => Array | null | Promise | null>; scalar_array_required: ( parent: {}, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | Promise; + ) => Array | Promise>; scalar_with_arg: ( parent: {}, @@ -938,14 +938,14 @@ export type Query_Custom_array_nullable_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => NumberNode[] | null | Promise; +) => Array | null | Promise | null>; export type Query_Custom_array_required_Resolver = ( parent: {}, args: {}, ctx: Context, info: GraphQLResolveInfo -) => NumberNode[] | Promise; +) => Array | Promise>; export type Query_Custom_with_arg_Resolver = ( parent: {}, @@ -980,14 +980,14 @@ export type Query_Scalar_array_nullable_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => boolean[] | null | Promise; +) => Array | null | Promise | null>; export type Query_Scalar_array_required_Resolver = ( parent: {}, args: {}, ctx: Context, info: GraphQLResolveInfo -) => boolean[] | Promise; +) => Array | Promise>; export type Query_Scalar_with_arg_Resolver = ( parent: {}, @@ -1030,14 +1030,17 @@ export interface Query_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => NumberNode[] | null | Promise; + ) => + | Array + | null + | Promise | null>; custom_array_required: ( parent: {}, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => NumberNode[] | Promise; + ) => Array | Promise>; custom_with_arg: ( parent: {}, @@ -1072,14 +1075,14 @@ export interface Query_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | null | Promise; + ) => Array | null | Promise | null>; scalar_array_required: ( parent: {}, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | Promise; + ) => Array | Promise>; scalar_with_arg: ( parent: {}, diff --git a/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap b/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap index 568dc06f..1f359f8e 100644 --- a/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap +++ b/packages/graphqlgen/src/tests/flow/__snapshots__/large-schema.test.ts.snap @@ -663,7 +663,7 @@ export const Home_defaultResolvers = { }; export interface Home_Args_Pictures { - first: number | null; + first?: number | null; } export type Home_Id_Resolver = ( @@ -1141,7 +1141,7 @@ export type User_Bookings_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => Booking[] | Promise; +) => Booking[] | null | Promise; export type User_CreatedAt_Resolver = ( parent: User, @@ -1169,7 +1169,7 @@ export type User_HostingExperiences_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => Experience[] | Promise; +) => Experience[] | null | Promise; export type User_Id_Resolver = ( parent: User, @@ -1204,21 +1204,21 @@ export type User_Notifications_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => Notification[] | Promise; +) => Notification[] | null | Promise; export type User_OwnedPlaces_Resolver = ( parent: User, args: {}, ctx: Context, info: GraphQLResolveInfo -) => Place[] | Promise; +) => Place[] | null | Promise; export type User_PaymentAccount_Resolver = ( parent: User, args: {}, ctx: Context, info: GraphQLResolveInfo -) => PaymentAccount[] | Promise; +) => PaymentAccount[] | null | Promise; export type User_Phone_Resolver = ( parent: User, @@ -1239,7 +1239,7 @@ export type User_ReceivedMessages_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => Message[] | Promise; +) => Message[] | null | Promise; export type User_ResponseRate_Resolver = ( parent: User, @@ -1260,7 +1260,7 @@ export type User_SentMessages_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => Message[] | Promise; +) => Message[] | null | Promise; export type User_UpdatedAt_Resolver = ( parent: User, @@ -1282,7 +1282,7 @@ export interface User_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Booking[] | Promise; + ) => Booking[] | null | Promise; createdAt: ( parent: User, @@ -1310,7 +1310,7 @@ export interface User_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Experience[] | Promise; + ) => Experience[] | null | Promise; id: ( parent: User, @@ -1345,21 +1345,21 @@ export interface User_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Notification[] | Promise; + ) => Notification[] | null | Promise; ownedPlaces: ( parent: User, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Place[] | Promise; + ) => Place[] | null | Promise; paymentAccount: ( parent: User, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => PaymentAccount[] | Promise; + ) => PaymentAccount[] | null | Promise; phone: ( parent: User, @@ -1380,7 +1380,7 @@ export interface User_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Message[] | Promise; + ) => Message[] | null | Promise; responseRate: ( parent: User, @@ -1401,7 +1401,7 @@ export interface User_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Message[] | Promise; + ) => Message[] | null | Promise; updatedAt: ( parent: User, @@ -1703,7 +1703,7 @@ export type Place_Pictures_Resolver = ( args: {}, ctx: Context, info: GraphQLResolveInfo -) => Picture[] | Promise; +) => Picture[] | null | Promise; export type Place_Popularity_Resolver = ( parent: Place, @@ -1858,7 +1858,7 @@ export interface Place_Resolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Picture[] | Promise; + ) => Picture[] | null | Promise; popularity: ( parent: Place, diff --git a/packages/graphqlgen/src/tests/typescript/__snapshots__/basic.test.ts.snap b/packages/graphqlgen/src/tests/typescript/__snapshots__/basic.test.ts.snap index 250fba1e..ed59ad95 100644 --- a/packages/graphqlgen/src/tests/typescript/__snapshots__/basic.test.ts.snap +++ b/packages/graphqlgen/src/tests/typescript/__snapshots__/basic.test.ts.snap @@ -176,15 +176,15 @@ export namespace MutationResolvers { export interface AddMemberData { email: string; projects: string[]; - sideProjects: string[] | null; + sideProjects?: Array | null; profile: ProfileData | null; - phones: PhoneData[]; + phones: Array; isVIP: boolean; } export interface ProfileData { - firstName: string | null; - lastName: string | null; - photo: Photo | null; + firstName?: string | null; + lastName?: string | null; + photo?: Photo | null; } export interface PhoneData { number: string; @@ -504,14 +504,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | null | Promise; + ) => Array | null | Promise | null>; export type Custom_array_requiredResolver = ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | Promise; + ) => Array | Promise>; export type Custom_with_argResolver = ( parent: undefined, @@ -546,14 +546,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | null | Promise; + ) => Array | null | Promise | null>; export type Scalar_array_requiredResolver = ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | Promise; + ) => Array | Promise>; export type Scalar_with_argResolver = ( parent: undefined, @@ -596,14 +596,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | null | Promise; + ) => Array | null | Promise | null>; custom_array_required: ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | Promise; + ) => Array | Promise>; custom_with_arg: ( parent: undefined, @@ -638,14 +638,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | null | Promise; + ) => Array | null | Promise | null>; scalar_array_required: ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | Promise; + ) => Array | Promise>; scalar_with_arg: ( parent: undefined, @@ -1129,14 +1129,17 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => NumberNode[] | null | Promise; + ) => + | Array + | null + | Promise | null>; export type Custom_array_requiredResolver = ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => NumberNode[] | Promise; + ) => Array | Promise>; export type Custom_with_argResolver = ( parent: undefined, @@ -1171,14 +1174,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | null | Promise; + ) => Array | null | Promise | null>; export type Scalar_array_requiredResolver = ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | Promise; + ) => Array | Promise>; export type Scalar_with_argResolver = ( parent: undefined, @@ -1221,14 +1224,17 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => NumberNode[] | null | Promise; + ) => + | Array + | null + | Promise | null>; custom_array_required: ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => NumberNode[] | Promise; + ) => Array | Promise>; custom_with_arg: ( parent: undefined, @@ -1263,14 +1269,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | null | Promise; + ) => Array | null | Promise | null>; scalar_array_required: ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | Promise; + ) => Array | Promise>; scalar_with_arg: ( parent: undefined, @@ -1471,14 +1477,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | null | Promise; + ) => Array | null | Promise | null>; export type Custom_array_requiredResolver = ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | Promise; + ) => Array | Promise>; export type Custom_with_argResolver = ( parent: undefined, @@ -1513,14 +1519,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | null | Promise; + ) => Array | null | Promise | null>; export type Scalar_array_requiredResolver = ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | Promise; + ) => Array | Promise>; export type Scalar_with_argResolver = ( parent: undefined, @@ -1563,14 +1569,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | null | Promise; + ) => Array | null | Promise | null>; custom_array_required: ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Number[] | Promise; + ) => Array | Promise>; custom_with_arg: ( parent: undefined, @@ -1605,14 +1611,14 @@ export namespace QueryResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | null | Promise; + ) => Array | null | Promise | null>; scalar_array_required: ( parent: undefined, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => boolean[] | Promise; + ) => Array | Promise>; scalar_with_arg: ( parent: undefined, diff --git a/packages/graphqlgen/src/tests/typescript/__snapshots__/large-schema.test.ts.snap b/packages/graphqlgen/src/tests/typescript/__snapshots__/large-schema.test.ts.snap index 9ed15c4b..2fa30eeb 100644 --- a/packages/graphqlgen/src/tests/typescript/__snapshots__/large-schema.test.ts.snap +++ b/packages/graphqlgen/src/tests/typescript/__snapshots__/large-schema.test.ts.snap @@ -668,7 +668,7 @@ export namespace HomeResolvers { }; export interface ArgsPictures { - first: number | null; + first?: number | null; } export type IdResolver = ( @@ -1152,7 +1152,7 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Booking[] | Promise; + ) => Booking[] | null | Promise; export type CreatedAtResolver = ( parent: User, @@ -1180,7 +1180,7 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Experience[] | Promise; + ) => Experience[] | null | Promise; export type IdResolver = ( parent: User, @@ -1215,21 +1215,21 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Notification[] | Promise; + ) => Notification[] | null | Promise; export type OwnedPlacesResolver = ( parent: User, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Place[] | Promise; + ) => Place[] | null | Promise; export type PaymentAccountResolver = ( parent: User, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => PaymentAccount[] | Promise; + ) => PaymentAccount[] | null | Promise; export type PhoneResolver = ( parent: User, @@ -1250,7 +1250,7 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Message[] | Promise; + ) => Message[] | null | Promise; export type ResponseRateResolver = ( parent: User, @@ -1271,7 +1271,7 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Message[] | Promise; + ) => Message[] | null | Promise; export type UpdatedAtResolver = ( parent: User, @@ -1293,7 +1293,7 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Booking[] | Promise; + ) => Booking[] | null | Promise; createdAt: ( parent: User, @@ -1321,7 +1321,7 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Experience[] | Promise; + ) => Experience[] | null | Promise; id: ( parent: User, @@ -1356,21 +1356,21 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Notification[] | Promise; + ) => Notification[] | null | Promise; ownedPlaces: ( parent: User, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Place[] | Promise; + ) => Place[] | null | Promise; paymentAccount: ( parent: User, args: {}, ctx: Context, info: GraphQLResolveInfo - ) => PaymentAccount[] | Promise; + ) => PaymentAccount[] | null | Promise; phone: ( parent: User, @@ -1391,7 +1391,7 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Message[] | Promise; + ) => Message[] | null | Promise; responseRate: ( parent: User, @@ -1412,7 +1412,7 @@ export namespace UserResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Message[] | Promise; + ) => Message[] | null | Promise; updatedAt: ( parent: User, @@ -1716,7 +1716,7 @@ export namespace PlaceResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Picture[] | Promise; + ) => Picture[] | null | Promise; export type PopularityResolver = ( parent: Place, @@ -1871,7 +1871,7 @@ export namespace PlaceResolvers { args: {}, ctx: Context, info: GraphQLResolveInfo - ) => Picture[] | Promise; + ) => Picture[] | null | Promise; popularity: ( parent: Place,