@@ -13,17 +13,17 @@ Allows to share and re-use mutation options in a type-safe way.
1313
1414``` ts
1515export class QueriesService {
16- private http = inject (HttpClient );
16+ private http = inject (HttpClient )
1717
1818 updatePost(id : number ) {
1919 return mutationOptions ({
2020 mutationFn : (post : Post ) => Promise .resolve (post ),
21- mutationKey: [" updatePost" , id ],
21+ mutationKey: [' updatePost' , id ],
2222 onSuccess : (newPost ) => {
2323 // ^? newPost: Post
24- this .queryClient .setQueryData ([" posts" , id ], newPost )
24+ this .queryClient .setQueryData ([' posts' , id ], newPost )
2525 },
26- });
26+ })
2727 }
2828}
2929
@@ -45,7 +45,12 @@ The mutation options.
4545## Call Signature
4646
4747``` ts
48- function mutationOptions<TData , TError , TVariables , TContext >(options ): WithRequired <CreateMutationOptions <TData , TError , TVariables , TContext >, " mutationKey" >
48+ function mutationOptions<TData , TError , TVariables , TContext >(
49+ options ,
50+ ): WithRequired <
51+ CreateMutationOptions <TData , TError , TVariables , TContext >,
52+ ' mutationKey'
53+ >
4954```
5055
5156Defined in : [mutation - options .ts :38 ](https :// github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/mutation-options.ts#L38)
@@ -56,17 +61,17 @@ Allows to share and re-use mutation options in a type-safe way.
5661
5762` ` ` ts
5863export class QueriesService {
59- private http = inject(HttpClient);
64+ private http = inject(HttpClient)
6065
6166 updatePost(id: number) {
6267 return mutationOptions({
6368 mutationFn: (post: Post) => Promise.resolve(post),
64- mutationKey: [" updatePost" , id],
69+ mutationKey: [' updatePost' , id],
6570 onSuccess: (newPost) => {
6671 // ^? newPost: Post
67- this.queryClient.setQueryData([" posts" , id], newPost)
72+ this.queryClient.setQueryData([' posts' , id], newPost)
6873 },
69- });
74+ })
7075 }
7176}
7277
@@ -114,7 +119,12 @@ The mutation options.
114119## Call Signature
115120
116121` ` ` ts
117- function mutationOptions<TData, TError, TVariables, TContext>(options): Omit<CreateMutationOptions<TData, TError, TVariables, TContext>, "mutationKey">
122+ function mutationOptions<TData, TError, TVariables, TContext>(
123+ options,
124+ ): Omit<
125+ CreateMutationOptions<TData, TError, TVariables, TContext>,
126+ 'mutationKey'
127+ >
118128` ` `
119129
120130Defined in : [mutation - options .ts :52 ](https :// github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/mutation-options.ts#L52)
@@ -125,17 +135,17 @@ Allows to share and re-use mutation options in a type-safe way.
125135
126136` ` ` ts
127137export class QueriesService {
128- private http = inject(HttpClient);
138+ private http = inject(HttpClient)
129139
130140 updatePost(id: number) {
131141 return mutationOptions({
132142 mutationFn: (post: Post) => Promise.resolve(post),
133- mutationKey: [" updatePost" , id],
143+ mutationKey: [' updatePost' , id],
134144 onSuccess: (newPost) => {
135145 // ^? newPost: Post
136- this.queryClient.setQueryData([" posts" , id], newPost)
146+ this.queryClient.setQueryData([' posts' , id], newPost)
137147 },
138- });
148+ })
139149 }
140150}
141151
0 commit comments