Skip to content

Commit 809a817

Browse files
committed
removed-deduplication
1 parent d395aa9 commit 809a817

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

packages/plugins/tanstack-query/src/generator.ts

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ function generateMutationHook(
229229
switch (target) {
230230
case 'react':
231231
case 'vue':
232+
case 'angular':
232233
// override the mutateAsync function to return the correct type
233234
func.addVariableStatement({
234235
declarationKind: VariableDeclarationKind.Const,
@@ -278,31 +279,6 @@ function generateMutationHook(
278279
});
279280
break;
280281

281-
case 'angular':
282-
// Angular uses injectMutation which returns the mutation object directly
283-
// override the mutateAsync function to return the correct type
284-
func.addVariableStatement({
285-
declarationKind: VariableDeclarationKind.Const,
286-
declarations: [
287-
{
288-
name: 'mutation',
289-
initializer: `{
290-
..._mutation,
291-
mutateAsync: async <T extends ${argsType}>(
292-
args: Prisma.SelectSubset<T, ${argsType}>,
293-
options?: ${optionsType}
294-
) => {
295-
return (await _mutation.mutateAsync(
296-
args,
297-
options as any
298-
)) as ${returnType};
299-
},
300-
}`,
301-
},
302-
],
303-
});
304-
break;
305-
306282
default:
307283
throw new PluginError(name, `Unsupported target "${target}"`);
308284
}
@@ -628,7 +604,9 @@ function generateIndex(
628604
sf.addStatements(`export { SvelteQueryContextKey, setHooksContext } from '${runtimeImportBase}/svelte';`);
629605
break;
630606
case 'angular':
631-
sf.addStatements(`export { AngularQueryContextKey, provideAngularQueryContext } from '${runtimeImportBase}/angular';`);
607+
sf.addStatements(
608+
`export { AngularQueryContextKey, provideAngularQueryContext } from '${runtimeImportBase}/angular';`
609+
);
632610
break;
633611
}
634612
sf.addStatements(`export { default as metadata } from './__model_meta';`);

0 commit comments

Comments
 (0)