From 8fe80629500ee4897862b1e13917ad3fe6f7d95a Mon Sep 17 00:00:00 2001 From: AAGaming Date: Mon, 25 Sep 2023 13:23:38 -0400 Subject: move type checking to other workflow, fix TS errors, add TSC checking --- .github/workflows/lint.yml | 15 ++-------- .github/workflows/typecheck.yml | 33 ++++++++++++++++++++++ .../src/components/modals/filepicker/index.tsx | 9 ++++-- .../settings/pages/general/BranchSelect.tsx | 6 ++-- .../settings/pages/general/StoreSelect.tsx | 6 ++-- frontend/tsconfig.json | 1 - 6 files changed, 48 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/typecheck.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6fb35586..24e756bf 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,23 +11,12 @@ jobs: steps: - uses: actions/checkout@v2 # Check out the repository first. - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - [ -f requirements.txt ] && pip install -r requirements.txt - - - name: Install JavaScript dependencies + - name: Install TypeScript dependencies working-directory: frontend run: | npm i -g pnpm pnpm i --frozen-lockfile - - name: Run pyright (Python) - uses: jakebailey/pyright-action@v1 - with: - python-version: "3.10.6" - no-comments: true - - - name: Run prettier (JavaScript & TypeScript) + - name: Run prettier (TypeScript) working-directory: frontend run: pnpm run lint \ No newline at end of file diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml new file mode 100644 index 00000000..d54c4048 --- /dev/null +++ b/.github/workflows/typecheck.yml @@ -0,0 +1,33 @@ +name: Type check + +on: + push: + +jobs: + typecheck: + name: Run type checkers + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 # Check out the repository first. + + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + [ -f requirements.txt ] && pip install -r requirements.txt + + - name: Install TypeScript dependencies + working-directory: frontend + run: | + npm i -g pnpm + pnpm i --frozen-lockfile + + - name: Run pyright (Python) + uses: jakebailey/pyright-action@v1 + with: + python-version: "3.10.6" + no-comments: true + + - name: Run tsc (TypeScript) + working-directory: frontend + run: $(pnpm bin)/tsc --noEmit \ No newline at end of file diff --git a/frontend/src/components/modals/filepicker/index.tsx b/frontend/src/components/modals/filepicker/index.tsx index ae745c9c..c4e72d95 100644 --- a/frontend/src/components/modals/filepicker/index.tsx +++ b/frontend/src/components/modals/filepicker/index.tsx @@ -13,7 +13,7 @@ import { } from 'decky-frontend-lib'; import { filesize } from 'filesize'; import { FunctionComponent, useCallback, useEffect, useMemo, useState } from 'react'; -import { FileIcon, defaultStyles } from 'react-file-icon'; +import { DefaultExtensionType, FileIcon, defaultStyles } from 'react-file-icon'; import { useTranslation } from 'react-i18next'; import { FaArrowUp, FaFolder } from 'react-icons/fa'; @@ -316,7 +316,12 @@ const FilePicker: FunctionComponent = ({ ) : (
{file.realpath.includes('.') ? ( - + ) : ( )} diff --git a/frontend/src/components/settings/pages/general/BranchSelect.tsx b/frontend/src/components/settings/pages/general/BranchSelect.tsx index 9b304f3a..1af06823 100644 --- a/frontend/src/components/settings/pages/general/BranchSelect.tsx +++ b/frontend/src/components/settings/pages/general/BranchSelect.tsx @@ -29,10 +29,10 @@ const BranchSelect: FunctionComponent<{}> = () => { typeof branch == 'string') + .filter((branch) => typeof branch == 'number') .map((branch) => ({ - label: tBranches[UpdateBranch[branch]], - data: UpdateBranch[branch], + label: tBranches[branch as number], + data: branch, }))} selectedOption={selectedBranch} onChange={async (newVal) => { diff --git a/frontend/src/components/settings/pages/general/StoreSelect.tsx b/frontend/src/components/settings/pages/general/StoreSelect.tsx index ebf1bd81..3cb80303 100644 --- a/frontend/src/components/settings/pages/general/StoreSelect.tsx +++ b/frontend/src/components/settings/pages/general/StoreSelect.tsx @@ -26,10 +26,10 @@ const StoreSelect: FunctionComponent<{}> = () => { typeof store == 'string') + .filter((store) => typeof store == 'number') .map((store) => ({ - label: tStores[Store[store]], - data: Store[store], + label: tStores[store as number], + data: store, }))} selectedOption={selectedStore} onChange={async (newVal) => { diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json index e693d3e9..6b18e4e4 100644 --- a/frontend/tsconfig.json +++ b/frontend/tsconfig.json @@ -14,7 +14,6 @@ "noImplicitThis": true, "noImplicitAny": true, "strict": true, - "suppressImplicitAnyIndexErrors": true, "allowSyntheticDefaultImports": true, "skipLibCheck": true, "resolveJsonModule": true -- cgit v1.2.3