Skip to content

Commit

Permalink
fix: lint issue in generated swr/tanstack hooks (zenstackhq#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 authored Dec 2, 2023
1 parent baed462 commit 4577232
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/plugins/swr/src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ function generateMutation(
`const mutation = request.useModelMutation('${model.name}', '${method}', '${operation}', metadata, options, ${checkReadBack});`,
`return {
...mutation,
trigger<T extends ${argsType}>(args: ${genericInputType}) {
trigger: <T extends ${argsType}>(args: ${genericInputType}) => {
return mutation.trigger(args, options as any) as Promise<${genericReturnType}>;
}
};`,
Expand Down
8 changes: 4 additions & 4 deletions packages/plugins/tanstack-query/src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ function generateMutationHook(
name: 'mutation',
initializer: `{
..._mutation,
async mutateAsync<T extends ${argsType}>(
mutateAsync: async <T extends ${argsType}>(
args: Prisma.SelectSubset<T, ${argsType}>,
options?: ${optionsType}
) {
) => {
return (await _mutation.mutateAsync(
args,
options as any
Expand All @@ -236,10 +236,10 @@ function generateMutationHook(
name: 'mutation',
initializer: `derived(_mutation, value => ({
...value,
async mutateAsync<T extends ${argsType}>(
mutateAsync: async <T extends ${argsType}>(
args: Prisma.SelectSubset<T, ${argsType}>,
options?: ${optionsType}
) {
) => {
return (await value.mutateAsync(
args,
options as any
Expand Down

0 comments on commit 4577232

Please sign in to comment.