Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

Register.md

28 lines1.2 KB

1---
2id: Register
3title: Register
4---
5​
6<!-- DO NOT EDIT: this page is autogenerated from the type comments -->
7​
8Defined in: [packages/query-core/src/types.ts:71](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L71)
9​
10The interface to augment via declaration merging to override Query's default types repository-wide.
11Each field it declares replaces the default of the matching type: `defaultError` for [DefaultError](../type-aliases/DefaultError.md),
12`queryKey` for [QueryKey](../type-aliases/QueryKey.md), `mutationKey` for [MutationKey](../type-aliases/MutationKey.md), `queryMeta` for [QueryMeta](../type-aliases/QueryMeta.md) and
13`mutationMeta` for [MutationMeta](../type-aliases/MutationMeta.md). Leave a field out to keep that type's default.
14Augment the module you install β€” `@tanstack/react-query`, `@tanstack/vue-query`,
15`@tanstack/solid-query`, `@tanstack/svelte-query`, `@tanstack/preact-query`,
16`@tanstack/angular-query-experimental` or `@tanstack/lit-query`. Augmenting `@tanstack/query-core`
17works too and covers every adapter at once.
18​
19## Example
20​
21```ts
22// Use the module you installed β€” here, the React adapter.
23declare module '@tanstack/react-query' {
24 interface Register {
25 defaultError: AxiosError
26 }
28```