Skip to content

Commit 1f82b52

Browse files
authored
Update TS typecheck matrix and add TS native job (#5155)
* Update TS typecheck matrix * Add TS native preview job * Override module resolution for `tsgo` example * Ignore 6.0 deprecations for Node10 checks * Disable TS 7 job for now * Only use ignoreDeps for TS next * Restructure typetests to reduce duplication - Only run on push on master - Change React matrix to do 18 for edge TS versions, 19 for all - Change portability matrix to do Node for edge TS versions, Bundler for all
1 parent cbfeafe commit 1f82b52

File tree

1 file changed

+203
-37
lines changed

1 file changed

+203
-37
lines changed

.github/workflows/tests.yml

Lines changed: 203 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: CI
2-
on: [push, pull_request]
2+
on:
3+
push:
4+
branches: [master]
5+
pull_request:
36
defaults:
47
run:
58
working-directory: ./packages/toolkit
@@ -70,18 +73,12 @@ jobs:
7073
matrix:
7174
node: ['24.x']
7275
react:
73-
[
74-
{
75-
version: '^18',
76-
types: ^18,
77-
react-dom: { version: '^18', types: '^18' },
78-
},
79-
{
80-
version: '^19',
81-
types: '^19',
82-
react-dom: { version: '^19', types: '^19' },
83-
},
84-
]
76+
- version: '^18'
77+
types: '^18'
78+
react-dom: { version: '^18', types: '^18' }
79+
- version: '^19'
80+
types: '^19'
81+
react-dom: { version: '^19', types: '^19' }
8582

8683
steps:
8784
- name: Checkout repo
@@ -137,21 +134,90 @@ jobs:
137134
strategy:
138135
fail-fast: false
139136
matrix:
140-
node: ['24.x']
141-
ts: ['5.1', '5.2', '5.3', '5.4', '5.5', '5.6', '5.7', '5.8']
142-
react:
143-
[
144-
{
145-
version: '^18',
146-
types: ^18,
147-
react-dom: { version: '^18', types: '^18' },
148-
},
149-
{
150-
version: '^19',
151-
types: '^19',
152-
react-dom: { version: '^19', types: '^19' },
153-
},
154-
]
137+
# Sparse matrix: All TS versions with React 19, boundary TS versions with React 18
138+
include:
139+
# React 19 × all TS versions
140+
- node: '24.x'
141+
ts: '5.4'
142+
react:
143+
{
144+
version: '^19',
145+
types: '^19',
146+
react-dom: { version: '^19', types: '^19' },
147+
}
148+
- node: '24.x'
149+
ts: '5.5'
150+
react:
151+
{
152+
version: '^19',
153+
types: '^19',
154+
react-dom: { version: '^19', types: '^19' },
155+
}
156+
- node: '24.x'
157+
ts: '5.6'
158+
react:
159+
{
160+
version: '^19',
161+
types: '^19',
162+
react-dom: { version: '^19', types: '^19' },
163+
}
164+
- node: '24.x'
165+
ts: '5.7'
166+
react:
167+
{
168+
version: '^19',
169+
types: '^19',
170+
react-dom: { version: '^19', types: '^19' },
171+
}
172+
- node: '24.x'
173+
ts: '5.8'
174+
react:
175+
{
176+
version: '^19',
177+
types: '^19',
178+
react-dom: { version: '^19', types: '^19' },
179+
}
180+
- node: '24.x'
181+
ts: '5.9'
182+
react:
183+
{
184+
version: '^19',
185+
types: '^19',
186+
react-dom: { version: '^19', types: '^19' },
187+
}
188+
- node: '24.x'
189+
ts: 'next'
190+
react:
191+
{
192+
version: '^19',
193+
types: '^19',
194+
react-dom: { version: '^19', types: '^19' },
195+
}
196+
# React 18 × boundary TS versions only (5.4, 5.9, next)
197+
- node: '24.x'
198+
ts: '5.4'
199+
react:
200+
{
201+
version: '^18',
202+
types: '^18',
203+
react-dom: { version: '^18', types: '^18' },
204+
}
205+
- node: '24.x'
206+
ts: '5.9'
207+
react:
208+
{
209+
version: '^18',
210+
types: '^18',
211+
react-dom: { version: '^18', types: '^18' },
212+
}
213+
- node: '24.x'
214+
ts: 'next'
215+
react:
216+
{
217+
version: '^18',
218+
types: '^18',
219+
react-dom: { version: '^18', types: '^18' },
220+
}
155221

156222
steps:
157223
- name: Checkout repo
@@ -186,13 +252,22 @@ jobs:
186252
- name: Erase path aliases
187253
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json
188254

189-
- name: Test types
255+
- name: Test types (TS 5.x)
256+
if: matrix.ts != 'next' && !startsWith(matrix.ts, '6.')
190257
env:
191258
TEST_DIST: true
192259
run: |
193260
yarn tsc --version
194261
yarn type-tests
195262
263+
- name: Test types (TS 6.x/next)
264+
if: matrix.ts == 'next' || startsWith(matrix.ts, '6.')
265+
env:
266+
TEST_DIST: true
267+
run: |
268+
yarn tsc --version
269+
yarn tsc -p tsconfig.test.json --noEmit --ignoreDeprecations 6.0
270+
196271
test-published-artifact:
197272
name: Test Published Artifact ${{ matrix.example }}
198273

@@ -304,14 +379,50 @@ jobs:
304379
strategy:
305380
fail-fast: false
306381
matrix:
307-
node: ['24.x']
308-
ts: ['5.3', '5.4', '5.5', '5.6', '5.7', '5.8', '5.9', 'next']
309-
example:
310-
[
311-
{ name: 'bundler', moduleResolution: 'Bundler' },
312-
{ name: 'nodenext-cjs', moduleResolution: 'NodeNext' },
313-
{ name: 'nodenext-esm', moduleResolution: 'NodeNext' },
314-
]
382+
# Sparse matrix: All TS versions with bundler, boundary TS versions with nodenext
383+
include:
384+
# bundler × all TS versions
385+
- node: '24.x'
386+
ts: '5.4'
387+
example: { name: 'bundler', moduleResolution: 'Bundler' }
388+
- node: '24.x'
389+
ts: '5.5'
390+
example: { name: 'bundler', moduleResolution: 'Bundler' }
391+
- node: '24.x'
392+
ts: '5.6'
393+
example: { name: 'bundler', moduleResolution: 'Bundler' }
394+
- node: '24.x'
395+
ts: '5.7'
396+
example: { name: 'bundler', moduleResolution: 'Bundler' }
397+
- node: '24.x'
398+
ts: '5.8'
399+
example: { name: 'bundler', moduleResolution: 'Bundler' }
400+
- node: '24.x'
401+
ts: '5.9'
402+
example: { name: 'bundler', moduleResolution: 'Bundler' }
403+
- node: '24.x'
404+
ts: 'next'
405+
example: { name: 'bundler', moduleResolution: 'Bundler' }
406+
# nodenext-cjs × boundary TS versions only (5.4, 5.9, next)
407+
- node: '24.x'
408+
ts: '5.4'
409+
example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' }
410+
- node: '24.x'
411+
ts: '5.9'
412+
example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' }
413+
- node: '24.x'
414+
ts: 'next'
415+
example: { name: 'nodenext-cjs', moduleResolution: 'NodeNext' }
416+
# nodenext-esm × boundary TS versions only (5.4, 5.9, next)
417+
- node: '24.x'
418+
ts: '5.4'
419+
example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' }
420+
- node: '24.x'
421+
ts: '5.9'
422+
example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' }
423+
- node: '24.x'
424+
ts: 'next'
425+
example: { name: 'nodenext-esm', moduleResolution: 'NodeNext' }
315426
steps:
316427
- name: Checkout repo
317428
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
@@ -348,3 +459,58 @@ jobs:
348459
run: |
349460
npm --workspace=@examples-type-portability/${{ matrix.example.name }} pkg set type=module
350461
yarn workspace @examples-type-portability/${{ matrix.example.name }} run test --module ESNext --moduleResolution Node10 --preserveSymLinks --verbatimModuleSyntax false
462+
463+
test-types-native-preview:
464+
if: false # Disabled pending TS 7.0 compatibility fixes
465+
name: 'Test Types: TypeScript Native Preview'
466+
needs: [build]
467+
runs-on: ubuntu-latest
468+
continue-on-error: true
469+
strategy:
470+
matrix:
471+
node: ['24.x']
472+
steps:
473+
- name: Checkout repo
474+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
475+
476+
- name: Use node ${{ matrix.node }}
477+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5
478+
with:
479+
node-version: ${{ matrix.node }}
480+
cache: 'yarn'
481+
482+
- name: Install deps
483+
run: yarn install
484+
485+
- name: Install TypeScript Native Preview
486+
run: yarn add @typescript/native-preview
487+
488+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
489+
with:
490+
name: package
491+
path: packages/toolkit
492+
493+
- name: Install build artifact
494+
run: yarn add ./package.tgz
495+
496+
- name: Show installed RTK versions
497+
run: yarn info @reduxjs/toolkit
498+
499+
- name: Erase path aliases
500+
run: sed -i -e /@remap-prod-remove-line/d ./tsconfig.base.json
501+
502+
- name: Test types with tsgo
503+
env:
504+
TEST_DIST: true
505+
run: |
506+
yarn tsgo --version
507+
yarn tsgo -p tsconfig.test.json --noEmit --moduleResolution Bundler
508+
509+
- name: Install build artifact for type-portability example
510+
run: yarn workspace @examples-type-portability/bundler add $(pwd)/package.tgz
511+
512+
- name: Install TypeScript Native Preview for type-portability example
513+
run: yarn workspace @examples-type-portability/bundler add -D @typescript/native-preview
514+
515+
- name: Test type portability with tsgo (bundler example)
516+
run: yarn workspace @examples-type-portability/bundler exec tsgo --noEmit

0 commit comments

Comments
 (0)