Skip to content

Commit dae0da7

Browse files
authored
Merge pull request #4623 from reduxjs/feature/5.0-tooling-updates
2 parents c9e0650 + 2b7af71 commit dae0da7

File tree

6 files changed

+605
-553
lines changed

6 files changed

+605
-553
lines changed

.github/workflows/test.yaml

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
runs-on: ubuntu-latest
3030
strategy:
3131
matrix:
32-
node: ['16.x']
32+
node: ['18.x']
3333

3434
steps:
3535
- name: Checkout repo
@@ -62,7 +62,7 @@ jobs:
6262
strategy:
6363
fail-fast: false
6464
matrix:
65-
node: ['16.x']
65+
node: ['18.x']
6666
steps:
6767
- name: Checkout repo
6868
uses: actions/checkout@v2
@@ -99,8 +99,8 @@ jobs:
9999
strategy:
100100
fail-fast: false
101101
matrix:
102-
node: ['16.x']
103-
ts: ['4.7', '4.8', '4.9', '5.0']
102+
node: ['18.x']
103+
ts: ['4.7', '4.8', '4.9', '5.0', '5.1', '5.2', '5.3']
104104
steps:
105105
- name: Checkout repo
106106
uses: actions/checkout@v2
@@ -132,6 +132,28 @@ jobs:
132132
yarn test:typecheck
133133
yarn test:types
134134
135+
are-the-types-wrong:
136+
name: Check package config with are-the-types-wrong
137+
138+
needs: [build]
139+
runs-on: ubuntu-latest
140+
strategy:
141+
fail-fast: false
142+
matrix:
143+
node: ['18.x']
144+
steps:
145+
- name: Checkout repo
146+
uses: actions/checkout@v3
147+
148+
- uses: actions/download-artifact@v3
149+
with:
150+
name: package
151+
path: .
152+
153+
# Note: We currently expect "FalseCJS" failures for Node16 + `moduleResolution: "node16"
154+
- name: Run are-the-types-wrong
155+
run: npx @arethetypeswrong/cli ./package.tgz --format table --ignore-rules false-cjs
156+
135157
test-published-artifact:
136158
name: Test Published Artifact ${{ matrix.example }}
137159

@@ -140,17 +162,8 @@ jobs:
140162
strategy:
141163
fail-fast: false
142164
matrix:
143-
node: ['16.x']
144-
example:
145-
[
146-
'cra4',
147-
'cra5',
148-
'next',
149-
'vite',
150-
'node-standard',
151-
'node-esm',
152-
'are-the-types-wrong'
153-
]
165+
node: ['18.x']
166+
example: ['cra4', 'cra5', 'next', 'vite', 'node-standard', 'node-esm']
154167
steps:
155168
- name: Checkout repo
156169
uses: actions/checkout@v2
@@ -190,15 +203,8 @@ jobs:
190203

191204
- name: Build example
192205
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
193-
run: yarn build
206+
run: NODE_OPTIONS=--openssl-legacy-provider yarn build
194207

195208
- name: Run test step
196209
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
197210
run: yarn test
198-
if: matrix.example != 'are-the-types-wrong'
199-
200-
- name: Run test step
201-
working-directory: ./redux-toolkit/examples/publish-ci/${{ matrix.example }}
202-
# Ignore "FalseCJS" errors in the `attw` job
203-
run: yarn test -n FalseCJS
204-
if: matrix.example == 'are-the-types-wrong'

errors.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
"13": "The slice reducer for key \"\" returned undefined when probed with a random type. Don't try to handle '' or other actions in \"redux/*\" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.",
1616
"14": "When called with an action of type , the slice reducer for key \"\" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.",
1717
"15": "Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.",
18-
"16": "bindActionCreators expected an object or a function, but instead received: ''. Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?"
18+
"16": "bindActionCreators expected an object or a function, but instead received: ''. Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?",
19+
"17": "Action \"type\" property must be a string. Instead, the actual type was: ''. Value was: '' (stringified)"
1920
}

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
ignore = "git diff --quiet HEAD^ HEAD -- ../docs/ ."
66

77
[build.environment]
8-
NODE_VERSION = "16.14.0"
8+
NODE_VERSION = "18.15.0"
99
NODE_OPTIONS = "--max_old_space_size=4096"
1010
NETLIFY_USE_YARN = "true"
1111
YARN_VERSION = "1.22.10"

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,12 @@
7474
"prettier": "^2.7.1",
7575
"rimraf": "^3.0.2",
7676
"rxjs": "^7.5.6",
77-
"tsup": "^6.7.0",
78-
"typescript": "^4.8.3",
79-
"vitest": "^0.27.2"
77+
"tsup": "7.0.0",
78+
"typescript": "5.2",
79+
"vitest": "^0.34.0"
80+
},
81+
"resolutions": {
82+
"esbuild": "0.19.7"
8083
},
8184
"sideEffects": false
8285
}

test/typescript/store.ts

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ const storeWithPreloadedState: Store<State> = createStore(reducer, {
6969
b: { c: 'c', d: 'd' },
7070
e: brandedString
7171
})
72-
// @ts-expect-error
73-
const storeWithBadPreloadedState: Store<State> = createStore(reducer, {
74-
b: { c: 'c' },
75-
e: brandedString
76-
})
72+
73+
const storeWithBadPreloadedState: Store<State> =
74+
// @ts-expect-error
75+
// prettier-ignore
76+
createStore(reducer, { b: { c: 'c' }, e: brandedString })
7777

7878
const reducerA: Reducer<string> = (state = 'a') => state
7979
const reducerB: Reducer<{ c: string; d: string }> = (
@@ -91,14 +91,11 @@ const storeWithCombineReducer = createStore(combinedReducer, {
9191
b: { c: 'c', d: 'd' },
9292
e: brandedString
9393
})
94-
// @ts-expect-error
95-
const storeWithCombineReducerAndBadPreloadedState = createStore(
96-
combinedReducer,
97-
{
98-
b: { c: 'c' },
99-
e: brandedString
100-
}
101-
)
94+
95+
const storeWithCombineReducerAndBadPreloadedState =
96+
// @ts-expect-error
97+
// prettier-ignore
98+
createStore( combinedReducer, { b: { c: 'c' }, e: brandedString } )
10299

103100
const nestedCombinedReducer = combineReducers({
104101
a: (state: string = 'a') => state,
@@ -120,10 +117,10 @@ const simpleCombinedReducer = combineReducers({
120117
d: (state: string = 'd') => state
121118
})
122119

123-
// @ts-expect-error
124-
const storeWithSimpleCombinedReducer = createStore(simpleCombinedReducer, {
125-
c: 5
126-
})
120+
const storeWithSimpleCombinedReducer =
121+
// @ts-expect-error
122+
// prettier-ignore
123+
createStore(simpleCombinedReducer, { c: 5 })
127124

128125
// Note: It's not necessary that the errors occur on the lines specified, just as long as something errors somewhere
129126
// since the preloaded state doesn't match the reducer type.
@@ -133,11 +130,10 @@ const simpleCombinedReducerWithImplicitState = combineReducers({
133130
d: (state = 'd') => state
134131
})
135132

136-
// @ts-expect-error
137-
const storeWithSimpleCombinedReducerWithImplicitState = createStore(
138-
simpleCombinedReducerWithImplicitState,
139-
{ c: 5 }
140-
)
133+
const storeWithSimpleCombinedReducerWithImplicitState =
134+
// @ts-expect-error
135+
// prettier-ignore
136+
createStore( simpleCombinedReducerWithImplicitState, { c: 5 } )
141137

142138
const storeWithActionReducer = createStore(reducerWithAction)
143139
const storeWithActionReducerAndPreloadedState = createStore(reducerWithAction, {
@@ -148,14 +144,10 @@ const storeWithActionReducerAndPreloadedState = createStore(reducerWithAction, {
148144
funcWithStore(storeWithActionReducer)
149145
funcWithStore(storeWithActionReducerAndPreloadedState)
150146

151-
// @ts-expect-error
152-
const storeWithActionReducerAndBadPreloadedState = createStore(
153-
reducerWithAction,
154-
{
155-
b: { c: 'c' },
156-
e: brandedString
157-
}
158-
)
147+
const storeWithActionReducerAndBadPreloadedState =
148+
// @ts-expect-error
149+
// prettier-ignore
150+
createStore( reducerWithAction, { b: { c: 'c' }, e: brandedString } )
159151

160152
const enhancer: StoreEnhancer = next => next
161153

0 commit comments

Comments
 (0)