-
Notifications
You must be signed in to change notification settings - Fork 614
chore: typecheck with tsgo #1278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughConfiguration updates to the development environment: VS Code settings now disable UnoCSS and enable TypeScript's experimental tsgo feature; package.json switches Node type-checking from tsc to tsgo and adds "@typescript/native-preview" dependency; tsconfig.node.json removes baseUrl in favor of explicit relative path prefixes and adds wildcard path mapping. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @.vscode/settings.json:
- Around line 8-10: Remove the experimental TypeScript flag
"typescript.experimental.useTsgo" from workspace settings (or set it to false)
so the repo doesn't force the incomplete TS Native Preview on all contributors;
if you intend to experiment, instead add "@typescript/native-preview" as a
devDependency, make the setting opt-in (move to a local/devcontainer/.vscode or
document as a personal setting) and add a short note in the repo docs/README
explaining it's unstable and requires the `@typescript/native-preview` package to
be installed.
In `@tsconfig.node.json`:
- Around line 15-23: The wildcard path mapping "*" -> ["./*"] can shadow
external packages when using moduleResolution: "bundler"; remove the "*" mapping
from the "paths" block (or replace it with a specific alias like "@app/*") so
that imports intended for node_modules are resolved normally, and keep the
existing "@/*" and "@shared/*" entries unchanged; ensure moduleResolution:
"bundler" behavior is preserved by not reintroducing a broad "*" entry.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.vscode/settings.jsonpackage.jsontsconfig.node.json
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,tsx,jsx,vue,json,mjs,cjs}
📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)
Use Prettier as the code formatter
Files:
package.jsontsconfig.node.json
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T02:41:45.219Z
Learning: Project uses Node.js ≥ 20.19 and pnpm ≥ 10.11 (pnpm only); Windows developers must enable Developer Mode for symlinks
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T09:23:07.415Z
Learning: Applies to **/*.{ts,tsx} : Enable strict TypeScript type checking
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T02:41:45.219Z
Learning: Applies to **/*.{ts,tsx,vue} : Configure Prettier with single quotes, no semicolons, and line width of 100 characters. Run `pnpm run format` after completing features
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-stack-guide.mdc:0-0
Timestamp: 2026-01-05T02:41:31.661Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Use TypeScript for all Vue components and composables with explicit type annotations
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2026-01-05T02:41:01.044Z
Learning: Pre-commit hooks enforce formatting, linting, and TypeScript type checking
📚 Learning: 2026-01-05T02:41:45.219Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T02:41:45.219Z
Learning: Project uses Node.js ≥ 20.19 and pnpm ≥ 10.11 (pnpm only); Windows developers must enable Developer Mode for symlinks
Applied to files:
package.json
📚 Learning: 2026-01-05T02:41:45.219Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T02:41:45.219Z
Learning: Applies to **/*.{ts,tsx,vue} : Configure Prettier with single quotes, no semicolons, and line width of 100 characters. Run `pnpm run format` after completing features
Applied to files:
package.jsontsconfig.node.json.vscode/settings.json
📚 Learning: 2026-01-05T02:41:45.219Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T02:41:45.219Z
Learning: Applies to **/*.{ts,tsx} : Use OxLint for linting JavaScript and TypeScript files; ensure lint-staged hooks and typecheck pass before commits
Applied to files:
package.json
📚 Learning: 2026-01-05T02:41:01.044Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2026-01-05T02:41:01.044Z
Learning: Pre-commit hooks enforce formatting, linting, and TypeScript type checking
Applied to files:
package.json
📚 Learning: 2026-01-05T02:41:01.044Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2026-01-05T02:41:01.044Z
Learning: Applies to **/*.{js,ts,tsx,jsx,vue,json,mjs,cjs} : Use Prettier as the code formatter
Applied to files:
package.jsontsconfig.node.json
📚 Learning: 2026-01-13T09:23:07.416Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T09:23:07.416Z
Learning: After completing a feature, run `pnpm run format && pnpm run lint` before submitting
Applied to files:
package.json
📚 Learning: 2026-01-13T09:23:07.415Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T09:23:07.415Z
Learning: Applies to **/*.{ts,tsx} : Enable strict TypeScript type checking
Applied to files:
package.jsontsconfig.node.json.vscode/settings.json
📚 Learning: 2026-01-05T02:41:01.044Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2026-01-05T02:41:01.044Z
Learning: Applies to **/*.{js,ts,tsx,jsx,mjs,cjs} : Use OxLint as the linter
Applied to files:
package.json
📚 Learning: 2026-01-13T09:23:07.415Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T09:23:07.415Z
Learning: Applies to **/*.test.ts : Write tests using Vitest with separate test suites for main and renderer processes
Applied to files:
package.json
📚 Learning: 2026-01-05T02:41:31.661Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-stack-guide.mdc:0-0
Timestamp: 2026-01-05T02:41:31.661Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Use TypeScript for all Vue components and composables with explicit type annotations
Applied to files:
package.json
📚 Learning: 2026-01-05T02:41:31.661Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-stack-guide.mdc:0-0
Timestamp: 2026-01-05T02:41:31.661Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Define TypeScript interfaces for Vue component props and data structures
Applied to files:
package.json
📚 Learning: 2026-01-05T02:41:13.302Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2026-01-05T02:41:13.302Z
Learning: Run 'pnpm run i18n:types' to generate TypeScript types for translation keys to enable autocomplete in code
Applied to files:
package.json
📚 Learning: 2026-01-05T02:41:45.219Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-05T02:41:45.219Z
Learning: Applies to src/shared/**/*.ts : Shared TypeScript types and utilities should be placed in `src/shared/`
Applied to files:
tsconfig.node.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-check (x64)
🔇 Additional comments (2)
package.json (2)
135-135: No action required. The project intentionally includes both@typescript/[email protected]andtypescript@^5.8.3as devDependencies, which is the designed pattern for using TypeScript 7 native previews alongside stable TypeScript. The native preview is used for development type-checking via tsgo, while the stable version remains available for other tools.
25-25: Fix incorrect TypeScript CLI flag syntax in typecheck scripts.The
--composite falseflag is incorrect. TypeScript/tsgo CLI uses--no-compositeinstead (negation style). Change lines 25 and 26:Corrected scripts
"typecheck:node": "tsgo --noEmit -p tsconfig.node.json --no-composite", "typecheck:web": "vue-tsc --noEmit -p tsconfig.app.json --no-composite",The tsgo CLI from
@typescript/native-previewis available and supports all required flags (--noEmit,-p), but the composite flag must use the TypeScript-style negation pattern.⛔ Skipped due to learnings
Learnt from: CR Repo: ThinkInAIXYZ/deepchat PR: 0 File: CLAUDE.md:0-0 Timestamp: 2026-01-13T09:23:07.415Z Learning: Applies to **/*.{ts,tsx} : Enable strict TypeScript type checkingLearnt from: CR Repo: ThinkInAIXYZ/deepchat PR: 0 File: AGENTS.md:0-0 Timestamp: 2026-01-05T02:41:45.219Z Learning: Applies to **/*.{ts,tsx} : Use OxLint for linting JavaScript and TypeScript files; ensure lint-staged hooks and typecheck pass before commitsLearnt from: CR Repo: ThinkInAIXYZ/deepchat PR: 0 File: .cursor/rules/i18n.mdc:0-0 Timestamp: 2026-01-05T02:41:13.302Z Learning: Applies to src/renderer/src/**/*.{ts,tsx,vue} : Ensure all code comments are in English and all log messages are in English, with no non-English text in code comments or console statementsLearnt from: CR Repo: ThinkInAIXYZ/deepchat PR: 0 File: .cursor/rules/vue-stack-guide.mdc:0-0 Timestamp: 2026-01-05T02:41:31.661Z Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx} : Use TypeScript for all Vue components and composables with explicit type annotationsLearnt from: CR Repo: ThinkInAIXYZ/deepchat PR: 0 File: AGENTS.md:0-0 Timestamp: 2026-01-05T02:41:45.219Z Learning: Applies to **/*.{ts,tsx,vue} : Configure Prettier with single quotes, no semicolons, and line width of 100 characters. Run `pnpm run format` after completing featuresLearnt from: CR Repo: ThinkInAIXYZ/deepchat PR: 0 File: .cursor/rules/development-setup.mdc:0-0 Timestamp: 2026-01-05T02:41:01.044Z Learning: Pre-commit hooks enforce formatting, linting, and TypeScript type checking
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
| "i18n-ally.pathMatcher": "{locale}/{namespaces}.json", | ||
| "unocss.disable": true, | ||
| "typescript.experimental.useTsgo": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
typescript.experimental.useTsgo VS Code support requirements
💡 Result:
Short answer: to enable "typescript.experimental.useTsgo" in VS Code you need the TypeScript native preview (tsgo) available to the editor (either the @typescript/native-preview tsgo binary in your workspace or the TypeScript Native Preview VS Code extension) and a recent VS Code / TypeScript preview that supports the experimental setting. Then set "typescript.experimental.useTsgo": true in workspace or user settings. Note this is experimental and some editor features and emits are incomplete. [1][2][3]
Key items and links:
- Install preview compiler: npm install -D
@typescript/native-preview(provides tsgo) or use the TypeScript Native Preview extension. [4][1] - Enable in settings (workspace .vscode/settings.json or global): "typescript.experimental.useTsgo": true. [4][1]
- Requirements/limits: preview builds are experimental (missing some emits, refactor/code-action features, and feature parity is work-in-progress). Test cautiously and expect functionality gaps. [4][2]
Sources:
[1] Microsoft/typescript-go GitHub (native preview + VS Code note).
[2] TypeScript blog announcement “Announcing TypeScript Native Previews”.
[3] Community writeups / articles summarizing usage and caveats.
🌐 Web query:
typescript native preview tsgo experimental feature VS Code
💡 Result:
Short summary — what this is and how to try it:
-
What it is: Microsoft’s native TypeScript preview (codename “Corsa”) is a Go-based native port of the TypeScript toolchain. The preview publishes an npm package (
@typescript/native-preview) that supplies an executable named tsgo (works like tsc) and a VS Code extension “TypeScript (Native Preview)”. [1][2][3] -
How to try locally:
- Install the preview compiler in your project: npm install -D
@typescript/native-preview. Then run npx tsgo --project ./path/to/tsconfig.json. [1][3] - In VS Code install the “TypeScript (Native Preview)” extension and enable it via the Command Palette (“TypeScript Native Preview: Enable (Experimental)”) or by setting "typescript.experimental.useTsgo": true in settings. You can disable it with the corresponding command or by toggling that setting. [1]
- Install the preview compiler in your project: npm install -D
-
Benefits: Large projects report ~8–10x faster type-checks and improved editor responsiveness. [1][5]
-
Current limitations / cautions: It’s an opt‑in preview. Several CLI and editor features are still missing or incomplete (example: --build/project-references, declaration emit, some LSP features such as auto-imports, find‑all‑references, rename). Don’t swap into production CI/builds until you verify feature parity for your workflow. [1][2][5]
Sources: Microsoft announcement and docs, native‑preview npm/GitHub. [1][2][3][5]
🌐 Web query:
typescript.experimental.useTsgo stability deprecation status 2025
💡 Result:
Short answer: As of Jan 16, 2026 the setting "typescript.experimental.useTsgo" is an experimental toggle to opt into the TypeScript native (tsgo/Corsa) preview; it is not deprecated—it's the supported way to try the native preview in editors/VS Code. The native port remains experimental (feature gaps exist) and the TypeScript team is migrating toward a native 7.0 while keeping the JS 6.x line for compatibility; no public deprecation of the useTsgo setting has been announced. [1][2][3]
Sources
- TypeScript blog: “Announcing TypeScript Native Previews” (docs mention the "TypeScript > Experimental: Use Tsgo" setting). [1]
- TypeScript progress / roadmap (Dec 2025): describes native port (Corsa), migration plan toward TypeScript 7 and keeping 6.x compatibility; notes experimental gaps. [2]
- Coverage/analysis of the native port and preview status. [3]
Remove or defer typescript.experimental.useTsgo—it has significant feature gaps unsuitable for repo-wide use.
typescript.experimental.useTsgo is experimental and requires either @typescript/native-preview npm package or the TypeScript Native Preview extension. More importantly, the preview has incomplete implementations of critical features: auto-imports, find-all-references, rename, declaration emit, and --build/project-references are all missing or broken. This will degrade editor experience and CI reliability. The TypeScript team recommends deferring to production until feature parity is verified. If the team intends to experiment, ensure @typescript/native-preview is installed as a devDependency and document that the setting is opt-in and unstable.
🤖 Prompt for AI Agents
In @.vscode/settings.json around lines 8 - 10, Remove the experimental
TypeScript flag "typescript.experimental.useTsgo" from workspace settings (or
set it to false) so the repo doesn't force the incomplete TS Native Preview on
all contributors; if you intend to experiment, instead add
"@typescript/native-preview" as a devDependency, make the setting opt-in (move
to a local/devcontainer/.vscode or document as a personal setting) and add a
short note in the repo docs/README explaining it's unstable and requires the
`@typescript/native-preview` package to be installed.
| "*": [ | ||
| "./*" | ||
| ], | ||
| "@/*": [ | ||
| "src/main/*" | ||
| "./src/main/*" | ||
| ], | ||
| "@shared/*": [ | ||
| "src/shared/*" | ||
| "./src/shared/*" | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
find . -name "tsconfig*.json" -type f | head -20Repository: ThinkInAIXYZ/deepchat
Length of output: 121
🏁 Script executed:
cat -n tsconfig.node.jsonRepository: ThinkInAIXYZ/deepchat
Length of output: 741
🏁 Script executed:
cat -n tsconfig.jsonRepository: ThinkInAIXYZ/deepchat
Length of output: 457
🏁 Script executed:
find node_modules -path "*@electron-toolkit/tsconfig/tsconfig.node.json" -type f 2>/dev/null | head -1 | xargs cat 2>/dev/nullRepository: ThinkInAIXYZ/deepchat
Length of output: 47
🌐 Web query:
TypeScript baseUrl required for paths to work extends inheritance compilerOptions
💡 Result:
Short answer
- TypeScript resolves "paths" relative to compilerOptions.baseUrl when baseUrl is present; if baseUrl is not set the resolver falls back to the tsconfig file location. Use of paths no longer strictly requires baseUrl since TypeScript 4.1, but behavior differs when baseUrl is present. [1][2][3]
How extends works (inheritance)
- "extends" loads the base config first, then the inheriting config overrides it. Values in the child replace the base’s values (not deep-merged for some top-level arrays like files/include/exclude). Relative paths are resolved relative to the config file they come from. So a base config can provide compilerOptions (including baseUrl/paths) that the child will inherit unless the child overrides them. [1]
Practical notes / examples
- Typical tsconfig base providing aliases:
{
"compilerOptions": {
"baseUrl": "./src",
"paths": { "@app/": ["app/"] }
}
} - Child tsconfig that extends it inherits baseUrl/paths unless it overrides them:
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
// if you omit baseUrl here, the base's baseUrl remains in effect
}
} - If you drop baseUrl and only have paths, TypeScript 4.1+ will still accept paths, but tools or runtime helpers (tsconfig-paths, bundlers, tsc-alias) may expect baseUrl or different path formats—so test your build/runtime toolchain. [2][3]
Sources
- extends documentation (tsconfig extends behavior). [1]
- baseUrl documentation (behavior, note about 4.1). [2]
- paths documentation (resolution relative to baseUrl or tsconfig). [3]
References
[1] TypeScript tsconfig "extends" doc. (typescriptlang.org)
[2] TypeScript tsconfig "baseUrl" doc. (typescriptlang.org)
[3] TypeScript tsconfig "paths" doc. (typescriptlang.org)
Citations:
- 1: https://www.typescriptlang.org/tsconfig/extends.html?utm_source=openai
- 2: https://www.typescriptlang.org/tsconfig/baseUrl.html?utm_source=openai
- 3: https://www.typescriptlang.org/tsconfig/paths.html?utm_source=openai
🌐 Web query:
TypeScript wildcard path mapping "*" moduleResolution bundler shadowing
💡 Result:
Short answer
- A paths entry with the single wildcard "" can accidentally shadow normal Node/package resolution when using moduleResolution: "bundler" because "" matches any specifier and TypeScript will apply the longest matching pattern rules — so a catch-all can redirect imports that would otherwise resolve to node_modules or package exports. [1][2][3]
Why it happens
- "paths" is a TypeScript‑side aliasing mechanism (wildcard "" matches any string and is substituted into the target). It only affects typechecking/compilation resolution; it does not change emitted import strings, so runtime/bundler resolution must be configured to match. If "" maps broadly, TypeScript will prefer that mapping for many imports, effectively shadowing package lookups. [1][2]
- moduleResolution: "bundler" models how bundlers resolve modules (it’s more permissive about extensionless relative imports and supports imports/exports), so combining a "*" paths mapping with "bundler" can make TS accept imports that the runtime/bundler will later resolve differently or that will mask package imports. This can create confusing shadowing or runtime errors. [2][4]
How to avoid/fix it
- Don’t use a catch‑all "" unless you really need it. Prefer targeted aliases (e.g. "app/") so only intended imports are remapped. [1]
- If you must use "*", make specific patterns above it (TypeScript chooses the longest matching prefix). Order and specificity matter. [1]
- Mirror TypeScript aliases in your bundler (webpack/rollup/vite) via its alias/resolve config so runtime resolution matches TypeScript’s. If you rely on package resolution, prefer workspace symlinks (npm/yarn/pnpm workspaces) rather than aliasing. [1][3]
- For libraries intended for consumers, prefer node16/nodenext moduleResolution (or publish with package.json "exports"/"imports") so you don’t produce outputs that only work when consumers reproduce your TS aliases. Use package.json "imports" for published aliasing instead of paths. [3][2]
References
- TS docs: paths, wildcard behavior and matching rules. [1]
- TS docs: moduleResolution "bundler" description and guidance (infectiousness / bundling caveats). [2][4]
- TS guide: considerations when bundling libraries and why paths can break consumers; prefer workspaces or package.json imports/exports. [3]
Sources
[1] TypeScript — Modules / paths & wildcard substitutions.
[2] TypeScript — tsconfig moduleResolution (description of "bundler").
[3] TypeScript — Choosing compiler options / Considerations for bundling libraries.
[4] TypeScript — Modules theory and how bundler resolution differs from Node.
Remove the "*" wildcard path mapping; it can shadow external packages with moduleResolution: "bundler".
The "*": ["./*"] mapping is overly broad. With moduleResolution: "bundler", TypeScript will apply longest-match rules, and the wildcard can intercept imports intended for node_modules packages. Either remove it entirely or use a specific alias prefix (e.g., "@app/*") instead. If the extended config provides a baseUrl, it will be inherited; that is not a concern.
🤖 Prompt for AI Agents
In `@tsconfig.node.json` around lines 15 - 23, The wildcard path mapping "*" ->
["./*"] can shadow external packages when using moduleResolution: "bundler";
remove the "*" mapping from the "paths" block (or replace it with a specific
alias like "@app/*") so that imports intended for node_modules are resolved
normally, and keep the existing "@/*" and "@shared/*" entries unchanged; ensure
moduleResolution: "bundler" behavior is preserved by not reintroducing a broad
"*" entry.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.