Skip to content

Commit

Permalink
Fix TypeScript issues
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Mar 28, 2024
1 parent f3a16d4 commit acf10c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/starWarsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ const shipMutation = mutationWithClientMutationId({
outputFields: {
ship: {
type: shipType,
resolve: (payload) => getShip(payload.shipId),
resolve: (payload: any) => getShip(payload.shipId),
},
faction: {
type: factionType,
Expand Down
14 changes: 11 additions & 3 deletions src/mutation/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ import type {
ThunkObjMap,
} from 'graphql';

type MutationFn<TInput = any, TOutput = unknown, TContext = any> = (object: TInput, ctx: TContext, info: GraphQLResolveInfo) => TOutput;
type MutationFn<TInput = any, TOutput = unknown, TContext = any> = (
object: TInput,
ctx: TContext,
info: GraphQLResolveInfo,
) => TOutput;

/**
* A description of a mutation consumable by mutationWithClientMutationId
Expand Down Expand Up @@ -44,9 +48,13 @@ interface MutationConfig<TInput = any, TOutput = unknown, TContext = any> {
* Returns a GraphQLFieldConfig for the mutation described by the
* provided MutationConfig.
*/
export function mutationWithClientMutationId<TInput = any, TOutput = unknown, TContext = any>(
export function mutationWithClientMutationId<
TInput = any,
TOutput = unknown,
TContext = any,
>(
config: MutationConfig<TInput, TOutput, TContext>,
): GraphQLFieldConfig<unknown, unknown> {
): GraphQLFieldConfig<unknown, TContext> {
const { name, inputFields, outputFields, mutateAndGetPayload } = config;
const augmentedInputFields = () => ({
...resolveObjMapThunk(inputFields),
Expand Down

0 comments on commit acf10c8

Please sign in to comment.