[AI] Switch typecheck from tsc to tsgo and fix Menu type narrowing (#7183)

* [AI] Switch typecheck from tsc to tsgo and fix Menu type narrowing

* [autofix.ci] apply automated fixes

* Add .gitignore for dist directory, update typecheck script in package.json to use -b flag, and remove noEmit option from tsconfig.json files in ci-actions and desktop-electron packages. Introduce typesVersions in loot-core package.json for improved type handling.

* Refactor SelectedTransactionsButton to improve type safety and readability. Updated items prop to use spread operator for conditional rendering of menu items, ensuring proper type annotations with MenuItem. This change enhances the clarity of the component's structure and maintains TypeScript compliance.

* Update tsconfig.json in desktop-electron package to maintain consistent formatting for plugins section. No functional changes made.

* [autofix.ci] apply automated fixes

* Update package.json and yarn.lock to add TypeScript 5.8.0 dependency. Adjust typesVersions in loot-core package.json for improved type handling. Enhance tsconfig.json in sync-server package to enable strictFunctionTypes for better type safety.

* Enhance tsconfig.json in ci-actions package by adding composite option for improved project references and build performance.

* [AI] Revert typescript to 5.9.3 for ts-node compatibility

Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>

* [AI] Update yarn.lock after TypeScript version change

Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>

* Refactor Menu component for improved type safety and readability. Updated type assertions for Menu.line and Menu.label, simplified type checks in filtering and selection logic, and enhanced conditional rendering of menu items. This change ensures better TypeScript compliance and maintains clarity in the component's structure.

* Refactor Select and OpenIdForm components to improve type safety and simplify logic. Updated item mapping to handle Menu.line more effectively, enhancing clarity in selection processes. Adjusted SelectedTransactionsButton to streamline item creation and improve readability.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Matiss Janis Aboltins <MatissJanis@users.noreply.github.com>
This commit is contained in:
Matiss Janis Aboltins
2026-03-14 21:03:10 +00:00
committed by GitHub
parent d86c9cf735
commit 9c61cfc145
23 changed files with 143 additions and 39 deletions

View File

@@ -10,9 +10,9 @@
"main": "dist/index.js",
"types": "@types/index.d.ts",
"scripts": {
"build": "yarn workspace loot-core exec tsc && vite build && node scripts/inline-loot-core-types.mjs",
"build": "yarn workspace loot-core exec tsgo && vite build && node scripts/inline-loot-core-types.mjs",
"test": "vitest --run",
"typecheck": "tsc -b && tsc-strict"
"typecheck": "tsgo -b && tsc-strict"
},
"dependencies": {
"@actual-app/crdt": "workspace:^",
@@ -23,8 +23,8 @@
"uuid": "^13.0.0"
},
"devDependencies": {
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"rollup-plugin-visualizer": "^6.0.5",
"typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"vite": "^7.3.1",
"vite-plugin-dts": "^4.5.4",

View File

@@ -1,7 +1,7 @@
/**
* Post-build script: copies loot-core declaration tree into @types/loot-core
* and rewrites index.d.ts to reference it so the published package is self-contained.
* Run after vite build; requires loot-core declarations (yarn workspace loot-core exec tsc).
* Run after vite build; requires loot-core declarations (yarn workspace loot-core exec tsgo).
*/
import fs from 'fs';
import path from 'path';
@@ -23,7 +23,7 @@ function main() {
}
if (!fs.existsSync(lootCoreDeclSrc)) {
console.error(
'Missing loot-core declarations; run: yarn workspace loot-core exec tsc',
'Missing loot-core declarations; run: yarn workspace loot-core exec tsgo',
);
process.exit(1);
}

1
packages/ci-actions/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
dist/*

View File

@@ -5,11 +5,11 @@
"scripts": {
"tsx": "node --import=extensionless/register --experimental-strip-types",
"test": "vitest --run",
"typecheck": "tsc --noEmit"
"typecheck": "tsgo -b"
},
"devDependencies": {
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"extensionless": "^2.0.6",
"typescript": "^5.9.3",
"vitest": "^4.0.18"
},
"extensionless": {

View File

@@ -8,7 +8,8 @@
"strict": true,
"types": ["node"],
"outDir": "dist",
"rootDir": "."
"rootDir": ".",
"composite": true
},
"include": ["src/**/*", "bin/**/*"],
"exclude": ["node_modules"]

View File

@@ -40,7 +40,7 @@
"test:web": "ENV=web vitest --run -c vitest.web.config.ts",
"start:storybook": "storybook dev -p 6006",
"build:storybook": "storybook build",
"typecheck": "tsc -b"
"typecheck": "tsgo -b"
},
"dependencies": {
"@emotion/css": "^11.13.5",
@@ -54,6 +54,7 @@
"@storybook/react-vite": "^10.2.7",
"@svgr/cli": "^8.1.0",
"@types/react": "^19.2.5",
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"eslint-plugin-storybook": "^10.2.7",
"react": "19.2.4",
"react-dom": "19.2.4",

View File

@@ -16,8 +16,8 @@ import { View } from './View';
const MenuLine: unique symbol = Symbol('menu-line');
const MenuLabel: unique symbol = Symbol('menu-label');
Menu.line = MenuLine;
Menu.label = MenuLabel;
Menu.line = MenuLine as typeof MenuLine;
Menu.label = MenuLabel as typeof MenuLabel;
type KeybindingProps = {
keyName: ReactNode;

View File

@@ -9,11 +9,11 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build:node": "tsc",
"build:node": "tsgo",
"proto:generate": "./bin/generate-proto",
"build": "rm -rf dist && yarn run build:node",
"test": "vitest --run",
"typecheck": "tsc -b"
"typecheck": "tsgo -b"
},
"dependencies": {
"google-protobuf": "^3.21.4",
@@ -22,9 +22,9 @@
},
"devDependencies": {
"@types/google-protobuf": "3.15.12",
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"protoc-gen-js": "3.21.4-4",
"ts-protoc-gen": "0.15.0",
"typescript": "^5.9.3",
"vitest": "^4.0.18"
}
}

View File

@@ -16,7 +16,7 @@
"e2e": "npx playwright test --browser=chromium",
"vrt": "cross-env VRT=true npx playwright test --browser=chromium",
"playwright": "playwright",
"typecheck": "tsc -b && tsc-strict"
"typecheck": "tsgo -b && tsc-strict"
},
"devDependencies": {
"@actual-app/components": "workspace:*",
@@ -45,6 +45,7 @@
"@types/react": "^19.2.5",
"@types/react-dom": "^19.2.3",
"@types/react-modal": "^3.16.3",
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"@uiw/react-codemirror": "^4.25.4",
"@use-gesture/react": "^10.3.1",
"@vitejs/plugin-basic-ssl": "^2.1.4",
@@ -91,7 +92,6 @@
"remark-gfm": "^4.0.1",
"rollup-plugin-visualizer": "^6.0.5",
"sass": "^1.97.3",
"typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"usehooks-ts": "^3.1.1",
"uuid": "^13.0.0",

View File

@@ -5,6 +5,7 @@
"noEmit": false,
"declaration": true,
"declarationMap": true,
"strict": false, // TODO: fix issues and remove this
"emitDeclarationOnly": true,
"outDir": "build/ts",
"rootDir": "src",

View File

@@ -25,7 +25,7 @@ import type {
import { copy, exists, mkdir, remove } from 'fs-extra';
import promiseRetry from 'promise-retry';
import type { GlobalPrefsJson } from 'loot-core/src/types/prefs';
import type { GlobalPrefsJson } from 'loot-core/types/prefs';
import { getMenu } from './menu';
import {

View File

@@ -8,8 +8,8 @@
"clean": "rm -rf dist",
"update-client": "bin/update-client",
"build": "yarn build:dist && electron-builder",
"build:dist": "tsc && yarn copy-static-assets",
"typecheck": "tsc -b && tsc-strict",
"build:dist": "tsgo && yarn copy-static-assets",
"typecheck": "tsgo -b && tsc-strict",
"copy-static-assets": "copyfiles --exclude 'build/**/*' **/*.html icons/**/* build/desktop-electron",
"watch": "yarn build:dist && cross-env ACTUAL_DOCUMENT_DIR=\"../../data\" ACTUAL_DATA_DIR=\"../../data\" electron .",
"e2e": "npx playwright test"
@@ -26,12 +26,12 @@
"@playwright/test": "1.58.2",
"@types/copyfiles": "^2",
"@types/fs-extra": "^11",
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"copyfiles": "^2.4.1",
"cross-env": "^10.1.0",
"electron": "39.2.7",
"electron-builder": "26.4.0",
"loot-core": "workspace:*",
"typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4"
},
"build": {

View File

@@ -8,6 +8,7 @@
"module": "CommonJS",
"moduleResolution": "node10",
"noEmit": false,
"strict": false, // TODO: fix issues and remove this
"declaration": true,
"declarationMap": true,
"outDir": "build",

View File

@@ -5,6 +5,13 @@
"license": "ISC",
"author": "",
"main": "index.js",
"typesVersions": {
"*": {
"types/*": [
"./src/types/*"
]
}
},
"exports": {
"./client/accounts/*": "./src/client/accounts/*.ts",
"./client/app/*": "./src/client/app/*.ts",
@@ -61,7 +68,7 @@
"test": "npm-run-all -cp 'test:*'",
"test:node": "ENV=node vitest --run",
"test:web": "ENV=web vitest --run -c vitest.web.config.ts",
"typecheck": "tsc -b && tsc-strict"
"typecheck": "tsgo -b && tsc-strict"
},
"dependencies": {
"@jlongster/sql.js": "^1.6.7",
@@ -82,7 +89,6 @@
"mitt": "^3.0.1",
"promise-retry": "^2.0.1",
"slash": "5.1.0",
"typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"ua-parser-js": "^2.0.9",
"uuid": "^13.0.0"
@@ -96,6 +102,7 @@
"@types/jlongster__sql.js": "npm:@types/sql.js@latest",
"@types/node": "^22.19.10",
"@types/pegjs": "^0.10.6",
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"assert": "^2.1.0",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
@@ -112,7 +119,6 @@
"rollup-plugin-visualizer": "^6.0.5",
"stream-browserify": "^3.0.0",
"ts-node": "^10.9.2",
"typescript": "^5.9.3",
"vite": "^7.3.1",
"vite-plugin-node-polyfills": "^0.25.0",
"vite-plugin-peggy-loader": "^2.0.1",

View File

@@ -4,6 +4,7 @@
"composite": true,
"noEmit": false,
"declaration": true,
"strict": false, // TODO: fix issues and remove this
"declarationMap": true,
"emitDeclarationOnly": true,
"outDir": "lib-dist/decl",

View File

@@ -9,15 +9,15 @@
"build": "cross-env NODE_ENV=production ./bin/build-service-worker",
"build-dev": "cross-env NODE_ENV=development ./bin/build-service-worker",
"watch": "cross-env NODE_ENV=development ./bin/build-service-worker --watch",
"typecheck": "tsc -b && tsc-strict"
"typecheck": "tsgo -b && tsc-strict"
},
"dependencies": {
"workbox-precaching": "^7.4.0"
},
"devDependencies": {
"@types/node": "^22.19.10",
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"cross-env": "^10.1.0",
"typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"vite": "^7.3.1"
}

View File

@@ -15,8 +15,8 @@
"scripts": {
"start": "yarn build && node build/app",
"start-monitor": "nodemon --exec 'yarn build && node build/app' --ignore './build/**/*' --ext 'ts,js' build/app",
"build": "tsc && yarn add-import-extensions && yarn copy-static-assets",
"typecheck": "tsc -b && tsc-strict",
"build": "tsgo && yarn add-import-extensions && yarn copy-static-assets",
"typecheck": "tsgo -b && tsc-strict",
"add-import-extensions": "node bin/add-import-extensions.mjs",
"copy-static-assets": "rm -rf build/src/sql && cp -r src/sql build/src/sql",
"test": "NODE_ENV=test NODE_OPTIONS='--experimental-vm-modules --import ./register-loader.mjs --trace-warnings' vitest --run",
@@ -61,10 +61,10 @@
"@types/express-actuator": "^1.8.3",
"@types/node": "^22.19.10",
"@types/supertest": "^6.0.3",
"@typescript/native-preview": "^7.0.0-dev.20260309.1",
"http-proxy-middleware": "^3.0.5",
"nodemon": "^3.1.11",
"supertest": "^7.2.2",
"typescript": "^5.9.3",
"typescript-strict-plugin": "^2.4.4",
"vitest": "^4.0.18"
}

View File

@@ -4,6 +4,8 @@
"composite": true,
"lib": ["ES2021"],
"noEmit": false,
"strict": false, // TODO: fix issues and remove this
"strictFunctionTypes": true,
"declaration": true,
"declarationMap": true,
"outDir": "build",