Skip to content

Commit 9eb4e33

Browse files
committed
chore(build): add typecheck step to react and react-router
1 parent 279fb16 commit 9eb4e33

11 files changed

Lines changed: 34 additions & 2 deletions

File tree

.github/workflows/actions/build-angular-server/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ runs:
2323
run: npm run lint
2424
shell: bash
2525
working-directory: ./packages/angular-server
26+
# No Typecheck step here. Unlike the rollup-built packages, which report
27+
# type errors as warnings and still exit 0, ng-packagr fails the build on
28+
# them, so the Build step below already covers this.
2629
- name: 🏗️ Build
2730
run: npm run build.prod
2831
shell: bash

.github/workflows/actions/build-angular/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ runs:
2323
run: npm run lint
2424
shell: bash
2525
working-directory: ./packages/angular
26+
# No Typecheck step here. Unlike the rollup-built packages, which report
27+
# type errors as warnings and still exit 0, ng-packagr fails the build on
28+
# them, so the Build step below already covers this.
2629
- name: 🏗️ Build
2730
run: npm run build
2831
shell: bash

.github/workflows/actions/build-react-router/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ runs:
2828
run: npm run lint
2929
shell: bash
3030
working-directory: ./packages/react-router
31+
# The rollup build reports type errors as warnings and still succeeds, so
32+
# this step is what keeps the package type-clean.
33+
- name: 🔎 Typecheck
34+
run: npm run typecheck
35+
shell: bash
36+
working-directory: ./packages/react-router
3137
- name: 🏗️ Build
3238
run: npm run build
3339
shell: bash

.github/workflows/actions/build-react/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ runs:
2323
run: npm run lint
2424
shell: bash
2525
working-directory: ./packages/react
26+
# The rollup build reports type errors as warnings and still succeeds, so
27+
# this step is what keeps the package type-clean.
28+
- name: 🔎 Typecheck
29+
run: npm run typecheck
30+
shell: bash
31+
working-directory: ./packages/react
2632
- name: 🏗️ Build
2733
run: npm run build
2834
shell: bash

docs/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ Refer to [Ionic's E2E testing guide](/core/src/utils/test/playwright/docs/README
323323
- Vue: [`/packages/vue/src`](/packages/vue/src)
324324
2. Make your changes to the files. If the change is overly complex or out of the ordinary, add comments so we can understand the changes.
325325
3. Run lint on the directory and make sure there are no errors.
326-
4. For Vue, run `npm run typecheck` in `/packages/vue` and `/packages/vue-router`. The rollup build only reports type errors as warnings, so a passing build does not mean the types are clean.
326+
4. For React and Vue, run `npm run typecheck` in each package you changed (`/packages/react`, `/packages/react-router`, `/packages/vue`, `/packages/vue-router`). These packages build with rollup, which only reports type errors as warnings, so a passing build does not mean the types are clean. Angular has no `typecheck` script because ng-packagr already fails the build on type errors.
327327
5. Build the project.
328328
6. After the build is finished, commit the changes. Please follow the [commit message format](#commit-message-format) for every commit.
329329
7. [Submit a Pull Request](#submit-pull-request) of your changes.

docs/react-router/testing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Ionic Framework supports multiple versions of React Router. As a result, we need to verify that Ionic works correctly with each of these React Router versions.
44

5+
## Type Checking
6+
7+
Run `npm run typecheck` in `packages/react-router` to check types. The rollup build only reports type errors as warnings, so a passing build does not mean the types are clean.
8+
59
## Syncing Local Changes
610

711
The React test app supports syncing your locally built changes for validation.

docs/react/testing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Ionic Framework supports multiple versions of React. As a result, we need to verify that Ionic works correctly with each of these React versions.
44

5+
## Type Checking
6+
7+
Run `npm run typecheck` in `packages/react` to check types. The rollup build only reports type errors as warnings, so a passing build does not mean the types are clean.
8+
59
## Syncing Local Changes
610

711
The React test app supports syncing your locally built changes for validation.

docs/vue-router/testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
## Tests
44

5-
* This package has no unit tests of its own. Its behavior is covered by the `@ionic/vue` test app, in `packages/vue/test/base/tests`. See [Vue Testing](../vue/testing.md).
5+
* This package has no unit tests of its own. Its behavior is covered by the `@ionic/vue` test app, in `packages/vue/test/base/tests`. Refer to [Vue Testing](../vue/testing.md).
66
* Run `npm run typecheck` to check types. The rollup build only reports type errors as warnings.
77
* Bug fix and feature PRs should have new tests verifying the PR functionality.

docs/vue/testing.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Ionic Framework supports multiple versions of Vue. As a result, we need to verify that Ionic works correctly with each of these Vue versions.
44

5+
## Type Checking
6+
7+
Run `npm run typecheck` in `packages/vue` to check types. The rollup build only reports type errors as warnings, so a passing build does not mean the types are clean.
8+
59
## Syncing Local Changes
610

711
The Vue test app supports syncing your locally built changes for validation.

packages/react-router/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"prettier": "prettier \"./src/**/*.{html,ts,tsx,js,jsx}\"",
2929
"lint": "npm run eslint && npm run prettier -- --write --cache",
3030
"lint.fix": "npm run eslint -- --fix && npm run prettier -- --write --cache",
31+
"typecheck": "tsc --noEmit",
3132
"sync": "sh ./scripts/sync.sh"
3233
},
3334
"main": "dist/index.js",

0 commit comments

Comments
 (0)