-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite
TakeTwo
, SkipTwo
and Mutate
to make them work for older…
… ts versions too (#1348) * create tsc v4.3.5 snapshot * rewrite `TakeTwo` and `SkipTwo` ...to work with both pre 4.3.5 and post 4.3.5 subtyping rules. The type `Test` in the following snippet resolves to `"yes"` for <=4.3.5 but `"no"` for >4.3.5 ```ts type Test = [string, number?] extends [unknown] ? "yes" : "no" ``` (note 4.3.5 is bisected via typescript playground which skips some versions so it might not be super accurate, but it's accurate enough) * fix lint * fix pretest script to use tsc script instead of tsc bin * revert tests * add a workflow to test with old tsc * fix typo * oops, we need to run tsc * test against build * fix regex 🤦♂️ * oops, something was missing * build in advance * wip: more older versions * wip: downgrade jest types * minimum ts version 4.1.5 * minor fix * make `Mutate` more complete ...wrt to the domain `StoreMutatorIdentifier[]` to help the type-checker * fix lint Co-authored-by: daishi <daishi@axlight.com>
- Loading branch information
Showing
6 changed files
with
63 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Test Old TypeScript | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
test_matrix: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
typescript: | ||
- 4.8.4 | ||
- 4.7.4 | ||
- 4.6.4 | ||
- 4.5.5 | ||
- 4.4.4 | ||
- 4.3.5 | ||
- 4.2.3 | ||
- 4.1.5 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
cache: yarn | ||
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | ||
- run: yarn install --frozen-lockfile --check-files | ||
- run: yarn build | ||
- name: Patch for Old TS | ||
run: | | ||
sed -i~ "s/\/\/ @ts-expect-error.*\[LATEST-TS-ONLY\]//" tests/*.tsx | ||
sed -i~ "s/\"exactOptionalPropertyTypes\": true,//" tsconfig.json | ||
sed -i~ "s/\"zustand\": \[\"\.\/src\/index\.ts\"\],/\"zustand\": [\".\/dist\/index.d.ts\"],/" tsconfig.json | ||
sed -i~ "s/\"zustand\/\*\": \[\"\.\/src\/\*\.ts\"\]/\"zustand\/*\": [\".\/dist\/*.d.ts\"]/" tsconfig.json | ||
sed -i~ "s/\"include\": .*/\"include\": [\"src\/types.d.ts\", \"dist\/**\/*\", \"tests\/**\/*\"],/" tsconfig.json | ||
- name: Test ${{ matrix.typescript }} | ||
run: | | ||
yarn add -D typescript@${{ matrix.typescript }} | ||
yarn tsc --noEmit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters