Skip to content

Commit

Permalink
strict typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
amattu2 committed Sep 16, 2024
1 parent 8f2026f commit 8a5309e
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 4 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/typescript-strict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: TypeScript (Strict)

on:
workflow_dispatch:
push:
branches:
- "*.*.*"
- "main"
- "master"
- "strict-typecheck"
pull_request:
branches: "*"

permissions:
contents: read

jobs:
typecheck:
name: Typecheck (Strict)
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"

- name: Cache node modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-modules-
- name: Install Dependencies
run: npm install

- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v34
with:
files: |
**/*.ts
**/*.tsx
- name: Run Typecheck on Changed Files
if: steps.changed-files.outputs.any_changed == 'true'
run: |
CHANGED_FILES=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | tr ' ' '\n' | grep -E '\.tsx?$')
if [ -n "$CHANGED_FILES" ]; then
npm run typecheck -- --strict $CHANGED_FILES
else
echo "No TypeScript files changed."
fi
4 changes: 0 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"compilerOptions": {
"target": "es5",
// fix Type 'Element' is not assignable to type 'ReactNode TS warning
"paths": {
"react": ["./node_modules/@types/react"]
},
"lib": [
"dom",
"dom.iterable",
Expand Down

0 comments on commit 8a5309e

Please sign in to comment.