Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/api/configureStore.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ For more details on how the `middleware` parameter works and the list of middlew
[`getDefaultMiddleware` docs page](./getDefaultMiddleware.mdx).

:::note Tuple
Typescript users are required to use a `Tuple` instance (if not using a `getDefaultMiddleware` result, which is already a `Tuple`), for better inference.
TypeScript users are required to use a `Tuple` instance (if not using a `getDefaultMiddleware` result, which is already a `Tuple`), for better inference.

```ts no-transpile
import { configureStore, Tuple } from '@reduxjs/toolkit'
Expand Down Expand Up @@ -212,12 +212,12 @@ configureStore({
})
```

Note that if using Typescript, the `middleware` option is required to be provided _before_ the enhancer option, as the type of `getDefaultEnhancers` depends on its result.
Note that if using TypeScript, the `middleware` option is required to be provided _before_ the enhancer option, as the type of `getDefaultEnhancers` depends on its result.

:::

:::note Tuple
Typescript users are required to use a `Tuple` instance (if not using a `getDefaultEnhancer` result, which is already a `Tuple`), for better inference.
TypeScript users are required to use a `Tuple` instance (if not using a `getDefaultEnhancer` result, which is already a `Tuple`), for better inference.

```ts no-transpile
import { configureStore, Tuple } from '@reduxjs/toolkit'
Expand Down
2 changes: 1 addition & 1 deletion docs/introduction/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ The [**Redux Fundamentals tutorial**](https://redux.js.org/tutorials/fundamental

### Learn Modern Redux Livestream

Redux maintainer Mark Erikson appeared on the "Learn with Jason" show to explain how we recommend using Redux today. The show includes a live-coded example app that shows how to use Redux Toolkit and React-Redux hooks with Typescript, as well as the new RTK Query data fetching APIs.
Redux maintainer Mark Erikson appeared on the "Learn with Jason" show to explain how we recommend using Redux today. The show includes a live-coded example app that shows how to use Redux Toolkit and React-Redux hooks with TypeScript, as well as the new RTK Query data fetching APIs.

See [the "Learn Modern Redux" show notes page](https://www.learnwithjason.dev/let-s-learn-modern-redux) for a transcript and links to the example app source.

Expand Down
2 changes: 1 addition & 1 deletion docs/rtk-query/usage/conditional-fetching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ If you want to prevent a query from automatically running, you can use the `skip
[remarks](docblock://query/react/buildHooks.ts?token=UseQuerySubscriptionOptions.skip)

:::tip
Typescript users may wish to use [`skipToken`](../api/created-api/hooks.mdx#skiptoken) as an alternative to the `skip` option in order to skip running a query, while still keeping types for the endpoint accurate.
TypeScript users may wish to use [`skipToken`](../api/created-api/hooks.mdx#skiptoken) as an alternative to the `skip` option in order to skip running a query, while still keeping types for the endpoint accurate.
:::

## Conditional Fetching Example
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Since Redux Toolkit is an abstraction layer that wraps around the Redux core, it

## Learn Modern Redux Livestream

Redux maintainer Mark Erikson appeared on the "Learn with Jason" show to explain how we recommend using Redux today. The show includes a live-coded example app that shows how to use Redux Toolkit and React-Redux hooks with Typescript, as well as the new RTK Query data fetching APIs.
Redux maintainer Mark Erikson appeared on the "Learn with Jason" show to explain how we recommend using Redux today. The show includes a live-coded example app that shows how to use Redux Toolkit and React-Redux hooks with TypeScript, as well as the new RTK Query data fetching APIs.

See [the "Learn Modern Redux" show notes page](https://www.learnwithjason.dev/let-s-learn-modern-redux) for a transcript and links to the example app source.

Expand Down
12 changes: 6 additions & 6 deletions docs/usage/migrating-rtk-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ We've updated the build output in several ways:

- **Build output is no longer transpiled!** Instead we target modern JS syntax (ES2020)
- Moved all build artifacts to live under `./dist/`, instead of separate top-level folders
- The lowest Typescript version we test against is now **TS 4.7**.
- The lowest TypeScript version we test against is now **TS 4.7**.

#### Dropping UMD builds

Expand Down Expand Up @@ -92,7 +92,7 @@ To fix this, there are three options:

<div class="typescript-only">

#### Typescript rewrite
#### TypeScript rewrite

In 2019, we began a community-powered conversion of the Redux codebase to TypeScript. The original effort was discussed in [#3500: Port to TypeScript](https://github.com/reduxjs/redux/issues/3500), and the work was integrated in PR [#3536: Convert to TypeScript](https://github.com/reduxjs/redux/issues/3536).

Expand All @@ -102,7 +102,7 @@ Redux core v5 is now built from that TS-converted source code. In theory, this s

Please report any unexpected compatibility issues on [Github](https://github.com/reduxjs/redux/issues)!

#### `AnyAction` deprecated in favour of `UnknownAction`
#### `AnyAction` deprecated in favor of `UnknownAction`

The Redux TS types have always exported an `AnyAction` type, which is defined to have `{type: string}` and treat any other field as `any`. This makes it easy to write uses like `console.log(action.whatever)`, but unfortunately does not provide any meaningful type safety.

Expand Down Expand Up @@ -136,7 +136,7 @@ In order to safely interact with values or access fields inside of the `action`

This new type is incompatible with the v4 `Middleware` type, so if a package's middleware is saying it's incompatible, check which version of Redux it's getting its types from! (See [overriding dependencies](#overriding-dependencies) later in this page.)

#### `PreloadedState` type removed in favour of `Reducer` generic
#### `PreloadedState` type removed in favor of `Reducer` generic

We've made tweaks to the TS types to improve type safety and behavior.

Expand Down Expand Up @@ -839,14 +839,14 @@ createReducer(initialState, {
})
```

While this was convenient (and other libraries in the Redux ecosystem such as `redux-saga` and `redux-observable` have supported this to various capacities), it didn't play well with Typescript and was generally a bit too "magic".
While this was convenient (and other libraries in the Redux ecosystem such as `redux-saga` and `redux-observable` have supported this to various capacities), it didn't play well with TypeScript and was generally a bit too "magic".

```ts
const test = todoAdded.toString()
// ^? typed as string, rather than specific action type
```

Over time, the action creator also gained a static `type` property and `match` method which were more explicit and worked better with Typescript.
Over time, the action creator also gained a static `type` property and `match` method which were more explicit and worked better with TypeScript.

```ts
const test = todoAdded.type
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/usage-with-typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ Import and use that pre-typed `createAppAsyncThunk` instead of the original, and

## `createEntityAdapter`

Usage of `createEntityAdapter` with Typescript varies based on whether your entities are normalized by an `id` property, or whether a custom `selectId` is needed.
Usage of `createEntityAdapter` with TypeScript varies based on whether your entities are normalized by an `id` property, or whether a custom `selectId` is needed.

If your entities are normalized by an `id` property, `createEntityAdapter` only requires you to specify the entity type as the single generic argument. For example:

Expand Down