Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: TypeScript Type Portability Issues #4467

Merged
merged 127 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
97e0b9f
Remove `esbuild` from root `package.json`'s `resolutions` field
aryaemami59 Jun 18, 2024
313bcd5
Add `esbuild` to `devDependencies` of `toolkit`
aryaemami59 Jun 18, 2024
e462868
Initial attempt at bundling type definitions
aryaemami59 Jun 18, 2024
682ef46
Add names to build artifacts
aryaemami59 Jun 18, 2024
557a22d
Add `satisfies `TsupOptions[]``
aryaemami59 Jun 18, 2024
1aa9d1f
Fix exports in `src/query/utils/index.ts` barrel file
aryaemami59 Jun 18, 2024
62808c0
Fix exports in `src/query/core/buildMiddleware/index.ts` barrel file
aryaemami59 Jun 18, 2024
35795ea
Fix exports in `src/query/core/index.ts` barrel file
aryaemami59 Jun 18, 2024
ef2139b
Remove relative `declare module`s
aryaemami59 Jun 18, 2024
bafcea8
Fix `build` command
aryaemami59 Jun 18, 2024
7e7c806
Bump `tsup` to version 8.1.0
aryaemami59 Jun 18, 2024
e490c7f
Bump `tsx` to version 4.15.6
aryaemami59 Jun 18, 2024
4fd11f0
Add a script to manually fix `unique symbol` exports
aryaemami59 Jun 18, 2024
022a492
Convert `TS4023` related interfaces in `createSlice.ts` to types
aryaemami59 Jun 18, 2024
80249af
Convert `GetSelectorsOptions` to a `type` alias
aryaemami59 Jun 18, 2024
dc98f3d
Rename `Id` to `Simplify` to prevent naming collision
aryaemami59 Jun 18, 2024
ea83923
Convert `QueryHooks` to a `type` alias
aryaemami59 Jun 18, 2024
993fc94
Convert `CaseReducerDefinition` to a `type` alias
aryaemami59 Jun 18, 2024
6ad9767
Export `UNINITIALIZED_VALUE`
aryaemami59 Jun 18, 2024
880ead2
De-duplicate `type` imports
aryaemami59 Jun 18, 2024
47665f3
Convert `PromiseWithKnownReason` to a `type` alias
aryaemami59 Jun 18, 2024
7a2b423
Convert `MutationHooks` to a `type` alias
aryaemami59 Jun 18, 2024
8cf59f9
Export `StartQueryActionCreatorOptions` type
aryaemami59 Jun 18, 2024
fab6018
Fix issue with renaming type imports
aryaemami59 Jun 18, 2024
6600116
De-duplicate `IgnorePaths` type
aryaemami59 Jun 18, 2024
26878d1
Remove `Omit` from `tsHelpers.ts` to avoid collision with native `Omit`
aryaemami59 Jun 18, 2024
7c6c4df
Rename `TypedActionCreator` to `TypedActionCreatorWithMatchFunction`
aryaemami59 Jun 18, 2024
d78f0b8
De-duplicate `GetState` type
aryaemami59 Jun 18, 2024
b6a9aad
Remove unused `_Keep` type in `createAsyncThunk.ts`
aryaemami59 Jun 18, 2024
641d685
Rename `GetDispatch` to `GetDispatchType`
aryaemami59 Jun 19, 2024
96d13da
Do not export `CacheLifecyclePromises`
aryaemami59 Jun 19, 2024
266ae17
Do not export `QueryLifecyclePromises`
aryaemami59 Jun 19, 2024
ed624ce
Do not export `LifecycleApi`
aryaemami59 Jun 19, 2024
653803e
Add `.js` extension to `uncheckedindexed` import path
aryaemami59 Jun 19, 2024
501d8ea
Patch `console-testing-library`
aryaemami59 Jun 19, 2024
96ad710
Add `type` imports in `sorted_state_adapter.test.ts`
aryaemami59 Jun 19, 2024
44fd8a1
Run type tests with `"moduleResolution": "Bundler"` during CI
aryaemami59 Jun 19, 2024
49de6d4
Add `@examples-type-portability/bundler` to workspaces
aryaemami59 Jun 19, 2024
c33f568
Update CI to test type portability with `moduleResolution Bundler`
aryaemami59 Jun 19, 2024
6cfc98c
Undo renaming of `Id` to `Simplify`
aryaemami59 Jun 19, 2024
bc9bb75
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Jun 21, 2024
3a729cb
Bump `tsx` to version 4.15.7
aryaemami59 Jun 21, 2024
8ef545d
Update lockfile
aryaemami59 Jun 21, 2024
7dff9c0
Bump `tsx` to version 4.16.0
aryaemami59 Jun 29, 2024
c261ea9
Bump `tsx` to version 4.16.2
aryaemami59 Jul 9, 2024
8a1a0ac
Update lockfile
aryaemami59 Jul 9, 2024
6bf5247
Undo export of `neverResolvedError`
aryaemami59 Jul 9, 2024
1c564ea
Add TypeScript version matrix for `@examples-type-portability/bundler`
aryaemami59 Jul 9, 2024
aa65109
Export `BaseEndpointDefinition`
aryaemami59 Jul 9, 2024
a1bb825
Fix job names in CI
aryaemami59 Jul 9, 2024
496ab20
Bump TypeScript to version 5.5 for `@examples-type-portability/bundler`
aryaemami59 Jul 9, 2024
c4bb3f2
Fix TS matrix
aryaemami59 Jul 9, 2024
1557c05
Convert `React` import to wildcard import
aryaemami59 Jul 9, 2024
6e1973e
Run type tests with `"moduleResolution": "Node10"` in CI
aryaemami59 Jul 9, 2024
0b11bea
Run type tests with `moduleResolution Node10` and `type module` in CI
aryaemami59 Jul 9, 2024
8204909
Add `next` to TS versions in matrix
aryaemami59 Jul 9, 2024
5d0460b
Enable `preserveSymLinks` when running `tsc` with `Node10`
aryaemami59 Jul 9, 2024
da9666d
Convert `EndpointDefinitionWithQueryFn` to a `type` alias
aryaemami59 Jul 9, 2024
044adf2
Convert `EndpointDefinitionWithQuery` to a `type` alias
aryaemami59 Jul 9, 2024
3c6f307
Merge `MutationExtraOptions` interface into a single declaration
aryaemami59 Jul 9, 2024
d2a6eb1
Merge `QueryExtraOptions` interface into a single declaration
aryaemami59 Jul 9, 2024
3bb9f98
Merge `ApiEndpointQuery` interface into a single declaration
aryaemami59 Jul 9, 2024
b0a2d30
Merge `ApiEndpointMutation` interface into a single declaration
aryaemami59 Jul 9, 2024
2909490
Merge `ApiModules` interface into a single declaration
aryaemami59 Jul 9, 2024
c48067d
Move `@examples-type-portability/bundler` to `type-portability/bundler`
aryaemami59 Jul 9, 2024
8dd5eeb
Add `@examples-type-portability/nodenext-cjs`
aryaemami59 Jul 9, 2024
f725a82
Run type portability tests on `@examples-type-portability/nodenext-cjs`
aryaemami59 Jul 9, 2024
f39ccca
Remove import attributes as they are not compatible with TypeScript v5.2
aryaemami59 Jul 9, 2024
2a65719
Add `@examples-type-portability/nodenext-esm`
aryaemami59 Jul 9, 2024
9127d43
Run type portability tests on `@examples-type-portability/nodenext-esm`
aryaemami59 Jul 9, 2024
0b39d78
Use matrices for type portability examples in CI
aryaemami59 Jul 9, 2024
db32e8b
Rename `examples` to `example`
aryaemami59 Jul 9, 2024
d814f51
Skip `Node10` ESM test for `@examples-type-portability/nodenext-cjs`
aryaemami59 Jul 9, 2024
df474bb
Run `Node10` tests with `preserveSymLinks` enabled
aryaemami59 Jul 9, 2024
38346a8
Disable `verbatimModuleSyntax` for `Node10`
aryaemami59 Jul 9, 2024
e79241a
Bump dependencies for `@examples-type-portability/nodenext-esm`
aryaemami59 Jul 9, 2024
74da1db
Bump dependencies for `@examples-type-portability/bundler`
aryaemami59 Jul 9, 2024
c51bb81
Fix description of `@examples-type-portability/bundler`
aryaemami59 Jul 9, 2024
d952023
Fix `tsconfig.json` of `@examples-type-portability/bundler`
aryaemami59 Jul 9, 2024
96907d5
Fix `package.json` of `@examples-type-portability/bundler`
aryaemami59 Jul 9, 2024
eebbc81
Update lockfile
aryaemami59 Jul 9, 2024
bbbce41
Export `_NEVER` symbol
aryaemami59 Jul 13, 2024
c4c7f8b
Fix the patch for `console-testing-library`
aryaemami59 Jul 17, 2024
7a40e40
Bump `tsup` and `esbuild`
aryaemami59 Jul 17, 2024
a379ea4
Convert `BaseActionCreator` to a `type` alias to prevent `TS4023`
aryaemami59 Jul 19, 2024
19225e6
Convert `WithMiddleware` to a `type` alias to prevent `TS4023`
aryaemami59 Jul 19, 2024
b84bf86
Convert `ReactDynamicMiddlewareInstance` to a `type` alias
aryaemami59 Jul 19, 2024
f989c2b
Export `AddMiddleware` type to prevent `TS4023`
aryaemami59 Jul 19, 2024
137f5d4
Export `CreateDispatchWithMiddlewareHook` type to prevent `TS4023`
aryaemami59 Jul 19, 2024
54ae0eb
Export `DynamicDispatch` type to prevent `TS4023`
aryaemami59 Jul 19, 2024
838710d
Convert `AddListenerOverloads` to a `type` alias to prevent `TS4023`
aryaemami59 Jul 19, 2024
c50bbb6
Convert `TypedActionCreatorWithMatchFunction` to a `type` alias
aryaemami59 Jul 19, 2024
019be7a
Convert `TypedActionCreator` to a `type` alias to prevent `TS4023`
aryaemami59 Jul 19, 2024
28af348
Test `createDynamicMiddleware` and `createListenerMiddleware` exports
aryaemami59 Jul 19, 2024
8a2af21
Bump `tsup` to version 8.2.0
aryaemami59 Jul 19, 2024
7eb130a
Fix `exportedUniqueSymbols` placement in `fixUniqueSymbolExports.mts`
aryaemami59 Jul 19, 2024
9d45110
Prioritize `GetState` type from `createAsyncThunk.ts`
aryaemami59 Jul 20, 2024
dfaddd3
Re-export `GetDispatchType` as `GetDispatch`
aryaemami59 Jul 20, 2024
2da072e
Add tests for custom module creation via declaration merging
aryaemami59 Jul 20, 2024
453d833
Test portability of types related to reducer creators
aryaemami59 Jul 20, 2024
883300f
Fix order of types in `cacheLifecycle.ts`
aryaemami59 Jul 20, 2024
83971b8
Add `CacheLifecycleQueryExtraOptions`
aryaemami59 Jul 20, 2024
f8c342f
Add `QueryLifecycleQueryExtraOptions`
aryaemami59 Jul 20, 2024
5b5a914
Add `CacheLifecycleMutationExtraOptions`
aryaemami59 Jul 20, 2024
2db682a
Add `QueryLifecycleMutationExtraOptions`
aryaemami59 Jul 20, 2024
7513d3b
Consolidate `CacheLifecycleMutationExtraOptions`
aryaemami59 Jul 20, 2024
d4ac1e1
Add `CacheCollectionQueryExtraOptions`
aryaemami59 Jul 23, 2024
b3e079b
Fix order of types in `buildSelectors.ts`
aryaemami59 Jul 23, 2024
6f8ad61
Bump `tsup` to version 8.2.2
aryaemami59 Jul 23, 2024
5e5d4bf
Add `BuildThunksApiEndpointQuery` type
aryaemami59 Jul 23, 2024
a303ae0
Add `BuildInitiateApiEndpointQuery` type
aryaemami59 Jul 23, 2024
6b680e1
Add `BuildSelectorsApiEndpointQuery` type
aryaemami59 Jul 23, 2024
30a868e
Add `BuildThunksApiEndpointMutation` type
aryaemami59 Jul 23, 2024
5c16d34
Add `BuildInitiateApiEndpointMutation` type
aryaemami59 Jul 23, 2024
10bb727
Add `BuildSelectorsApiEndpointMutation` type
aryaemami59 Jul 23, 2024
bae9b3c
Undo export of `QueryResultSelectorFactory` type
aryaemami59 Jul 23, 2024
593013c
Undo export of `MutationResultSelectorFactory` type
aryaemami59 Jul 23, 2024
6064600
Undo export of `StartQueryActionCreator` type
aryaemami59 Jul 23, 2024
fac9818
Undo export of `StartMutationActionCreator` type
aryaemami59 Jul 23, 2024
fc9b3b8
Move `ApiModules` interface to `module.ts`
aryaemami59 Jul 23, 2024
c8233fc
Merge branch 'master' of https://github.com/reduxjs/redux-toolkit int…
aryaemami59 Jul 23, 2024
ec0d450
Fix type imports in `src/entities/utils.ts`
aryaemami59 Jul 23, 2024
6859df5
Export `CombinedSliceReducer`
aryaemami59 Jul 23, 2024
aa34c66
Bump dependencies of type-portability examples
aryaemami59 Jul 23, 2024
c9e74ab
Remove unnecessary dependencies in type-portability examples
aryaemami59 Jul 23, 2024
39589d9
Export everything in type-portability example apps
aryaemami59 Jul 23, 2024
bd83e94
Bump `tsup` to version 8.2.3
aryaemami59 Jul 25, 2024
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
54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,60 @@ jobs:
TEST_DIST: true
run: yarn test

- name: Run type tests with `moduleResolution Bundler`
run: rm -rf dist && yarn tsc -p . --moduleResolution Bundler --module ESNext --noEmit false --declaration --emitDeclarationOnly --outDir dist --target ESNext && rm -rf dist

test-type-portability:
name: Test Type Portability with TypeScript ${{ matrix.ts }} and Node.js ${{ matrix.node }}
needs: [build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: ['20.x']
ts: ['5.0', '5.1', '5.2', '5.3', '5.4', '5.5', 'next']
example:
[
{ name: 'bundler', moduleResolution: 'Bundler' },
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
]
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Use node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'yarn'

- name: Install deps
run: yarn install

- uses: actions/download-artifact@v4
with:
name: package
path: packages/toolkit

- name: Install build artifact
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add $(pwd)/package.tgz

- name: Install TypeScript ${{ matrix.ts }}
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} add -D typescript@${{ matrix.ts }}

- name: Test type portability with `moduleResolution ${{ matrix.example.moduleResolution }}`
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test

- name: Test type portability with `moduleResolution Node10`
run: yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module CommonJS --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false

- name: Test type portability with `moduleResolution Node10` and `type module` in `package.json`
if: matrix.example.name == 'nodenext-esm' || matrix.example.name == 'bundler'
run: |
npm --workspace=@examples-type-portability/${{ matrix.example.name }} pkg set type=module
yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module ESNext --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false

test-types:
name: Test Types with TypeScript ${{ matrix.ts }}

Expand Down
37 changes: 32 additions & 5 deletions .yarn/patches/console-testing-library-npm-0.6.1-4d9957d402.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
diff --git a/package.json b/package.json
index b924e066ecfdb30917b9c1056b360834da357698..15e155bd84f9d16537ffe36f9a87debcb0ec3591 100644
--- a/package.json
+++ b/package.json
@@ -8,12 +8,15 @@
"type": "module",
"main": "dist/index.js",
"typings": "index.d.ts",
+ "types": "index.d.ts",
"exports": {
".": {
+ "types": "./index.d.ts",
"require": "./dist/index.js",
"default": "./src/index.js"
},
"./pure": {
+ "types": "./pure.d.ts",
"require": "./dist/pure.js",
"default": "./src/pure.js"
}
diff --git a/pure.d.ts b/pure.d.ts
index b13bb4eb87d0b316bb51bd6094b2353c6fc8527d..ee01cc9bd3233f5e67b050d48e22202b495a4a0a 100644
--- a/pure.d.ts
+++ b/pure.d.ts
@@ -1 +1 @@
-export * from './';
+export * from './index.js';
diff --git a/src/index.js b/src/index.js
index 90ff7fa3d7d4fa62dbbf638958ae4e28abd089a8..28434687b5163b7472e86bdb11bed69e0868e660 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,4 +1,4 @@
-import { mockConsole, createConsole } from './pure';
+import { mockConsole, createConsole } from './pure.js';

// Keep an instance of the original console and export it
const originalConsole = global.console;
diff --git a/src/pure.js b/src/pure.js
Expand All @@ -15,7 +42,7 @@ index b00ea2abbaea833e336676aa46e7ced2d59d6d88..42b83ed83fa16cf2234571500fe09868
@@ -228,10 +228,11 @@ export function restore() {
global.console = global.originalConsole;
}

+/*
if (typeof expect === 'function' && typeof expect.extend === 'function') {
expect.extend({
Expand All @@ -24,13 +51,13 @@ index b00ea2abbaea833e336676aa46e7ced2d59d6d88..42b83ed83fa16cf2234571500fe09868
+ // Workaround for custom inline snapshot matchers
const error = new Error();
const stacks = error.stack.split('\n');

@@ -245,7 +246,6 @@ if (typeof expect === 'function' && typeof expect.extend === 'function') {
error.stack = stacks.join('\n');

const context = Object.assign(this, { error });
- /* -------------------------------------------------------------- */

const testingConsoleInstance =
(received && received.testingConsole) || received;
@@ -270,3 +270,4 @@ if (typeof expect === 'function' && typeof expect.extend === 'function') {
Expand Down
42 changes: 42 additions & 0 deletions examples/type-portability/bundler/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "@examples-type-portability/bundler",
"private": true,
"version": "1.0.0",
"description": "testing type portability for moduleResolution Bundler",
"keywords": [],
"main": "src/index.tsx",
"dependencies": {
"@reduxjs/toolkit": "workspace:^",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-redux": "^9.1.2",
"react-router-dom": "^6.25.1",
"react-scripts": "5.0.1"
},
"devDependencies": {
"@types/node": "^20.14.11",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"typescript": "^5.5.4"
},
"eslintConfig": {
"extends": [
"react-app"
],
"rules": {
"react/react-in-jsx-scope": "off"
}
},
"scripts": {
"clean": "rm -rf dist",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "yarn clean && tsc -p tsconfig.json"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
36 changes: 36 additions & 0 deletions examples/type-portability/bundler/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { Link, Route, Routes } from 'react-router-dom'
import { Lazy } from './features/bundleSplitting'
import { CounterList } from './features/counter/CounterList'
import { PollingToggles } from './features/polling/PollingToggles'
import { PostsManager } from './features/posts/PostsManager'
import { TimeList } from './features/time/TimeList'

export function App() {
return (
<div className="App">
<div className="row">
<div className="column column1">
<span>
<Link to="/">Times</Link> | <Link to="/posts">Posts</Link> |{' '}
<Link to="/counters">Counter</Link> |{' '}
<Link to="/bundleSplitting">Bundle Splitting</Link>
</span>
</div>
<div className="column column1">
<PollingToggles />
</div>
</div>
<div />
<div>
<Routes>
<Route path="/" element={<TimeList />} />
<Route path="/counters" element={<CounterList />} />
<Route path="/posts/*" element={<PostsManager />} />
<Route path="/bundleSplitting" element={<Lazy />} />
</Routes>
</div>
</div>
)
}

export default App
51 changes: 51 additions & 0 deletions examples/type-portability/bundler/src/app/customModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type {
Api,
BaseQueryFn,
CoreModule,
EndpointDefinitions,
Module,
} from '@reduxjs/toolkit/query'
import { buildCreateApi, coreModule } from '@reduxjs/toolkit/query'

export const customModuleName = Symbol('customModule')
export type CustomModule = typeof customModuleName

// If we remove this, We should get a TypeScript error.
declare module '@reduxjs/toolkit/query' {
export interface ApiModules<
BaseQuery extends BaseQueryFn,
Definitions extends EndpointDefinitions,
ReducerPath extends string,
TagTypes extends string,
> {
[customModuleName]: {
endpoints: {
[K in keyof Definitions]: {
myEndpointProperty: string
}
}
}
}
}

export const myModule = (): Module<CustomModule> => ({
name: customModuleName,
init(api, options, context) {
// initialize stuff here if you need to

return {
injectEndpoint(endpoint, definition) {
const anyApi = api as any as Api<
any,
Record<string, any>,
string,
string,
CustomModule | CoreModule
>
anyApi.endpoints[endpoint].myEndpointProperty = 'test'
},
}
},
})

export const myCreateApi = buildCreateApi(coreModule(), myModule())
10 changes: 10 additions & 0 deletions examples/type-portability/bundler/src/app/dynamicMiddleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createDynamicMiddleware } from '@reduxjs/toolkit'

export const dynamicMiddleware = createDynamicMiddleware()

export const { addMiddleware, instanceId, middleware, withMiddleware } =
dynamicMiddleware

export const { withTypes, match, type } = withMiddleware

export const { withTypes: _withTypes } = addMiddleware
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { createDynamicMiddleware } from '@reduxjs/toolkit/react'
import { listenerMiddleware } from './listenerMiddleware'

export const dynamicReactMiddleware = createDynamicMiddleware()

export const {
addMiddleware,
createDispatchWithMiddlewareHook,
createDispatchWithMiddlewareHookFactory,
instanceId,
middleware,
withMiddleware,
} = dynamicReactMiddleware

export const { withTypes } = addMiddleware

export const useDispatchWithMiddleware = createDispatchWithMiddlewareHook(
listenerMiddleware.middleware,
)
6 changes: 6 additions & 0 deletions examples/type-portability/bundler/src/app/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { useDispatch, useSelector, useStore } from 'react-redux'
import type { AppDispatch, AppStore, RootState } from './store'

export const useAppDispatch = useDispatch.withTypes<AppDispatch>()
export const useAppSelector = useSelector.withTypes<RootState>()
export const useAppStore = useStore.withTypes<AppStore>()
10 changes: 10 additions & 0 deletions examples/type-portability/bundler/src/app/listenerMiddleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createListenerMiddleware } from '@reduxjs/toolkit'

export const listenerMiddleware = createListenerMiddleware()

export const { clearListeners, middleware, startListening, stopListening } =
listenerMiddleware

export const { withTypes } = startListening

export const { withTypes: _withTypes } = stopListening
Loading
Loading