Skip to content

Commit 2039b72

Browse files
authored
feat: support typescript-go checks (#78)
* feat: support typescript-go checks * chore: address tsgo review feedback * chore: simplify tsgo path fallback
1 parent ea0ff7c commit 2039b72

8 files changed

Lines changed: 356 additions & 132 deletions

File tree

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ const defaultOptions = {
117117
memoryLimit: 8192,
118118
// use tsconfig of user project
119119
configFile: tsconfigPath,
120+
tsgo: false,
120121
// use typescript of user project
121-
typescriptPath: require.resolve('typescript'),
122+
typescriptPath: tsgo
123+
? require.resolve('@typescript/native-preview/package.json')
124+
: require.resolve('typescript'),
122125
},
123126
issue: {
124127
// ignore types errors from node_modules
@@ -136,6 +139,26 @@ const defaultOptions = {
136139
};
137140
```
138141

142+
#### TypeScript Go support
143+
144+
TypeScript Go support is powered by `ts-checker-rspack-plugin`'s experimental, CLI-based integration for [typescript-go](https://github.com/microsoft/typescript-go). It runs the `tsgo` binary for type checking and can reduce type-checking time by about 5-10x.
145+
146+
To enable it, install `@typescript/native-preview` and set `typescript.tsgo` to `true`:
147+
148+
```ts
149+
pluginTypeCheck({
150+
tsCheckerOptions: {
151+
typescript: {
152+
tsgo: true,
153+
},
154+
},
155+
});
156+
```
157+
158+
When `tsgo` is enabled, the default `typescript.typescriptPath` resolves to `@typescript/native-preview/package.json`. If you set `typescript.typescriptPath` manually in `tsgo` mode, it must be an absolute path to `@typescript/native-preview/package.json`.
159+
160+
For supported options and limitations, see [ts-checker-rspack-plugin - TypeScript Go support](https://github.com/rstackjs/ts-checker-rspack-plugin#typescript-go-support).
161+
139162
#### Object Type
140163

141164
When the value of `tsCheckerOptions` is an object, it will be deeply merged with the default configuration.

package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
],
1818
"scripts": {
1919
"build": "rslib",
20+
"bump": "npx bumpp",
2021
"dev": "rslib -w",
2122
"lint": "rslint && prettier -c .",
2223
"lint:write": "rslint --fix && prettier -w .",
2324
"prepare": "simple-git-hooks",
24-
"test": "playwright test",
25-
"bump": "npx bumpp"
25+
"test": "playwright test"
2626
},
2727
"simple-git-hooks": {
2828
"pre-commit": "pnpm run lint:write"
2929
},
3030
"dependencies": {
3131
"deepmerge": "^4.3.1",
32-
"ts-checker-rspack-plugin": "^1.3.1",
3332
"json5": "^2.2.3",
34-
"reduce-configs": "^1.1.2"
33+
"reduce-configs": "^1.1.2",
34+
"ts-checker-rspack-plugin": "^1.4.0"
3535
},
3636
"devDependencies": {
3737
"@playwright/test": "^1.60.0",
@@ -40,18 +40,23 @@
4040
"@rslint/core": "^0.5.3",
4141
"@types/fs-extra": "^11.0.4",
4242
"@types/node": "^24.12.4",
43+
"@typescript/native-preview": "7.0.0-dev.20260607.1",
4344
"fs-extra": "^11.3.5",
4445
"playwright": "^1.60.0",
4546
"prettier": "^3.8.3",
4647
"simple-git-hooks": "^2.13.1",
4748
"typescript": "^6.0.3"
4849
},
4950
"peerDependencies": {
50-
"@rsbuild/core": "^1.0.0 || ^2.0.0"
51+
"@rsbuild/core": "^1.0.0 || ^2.0.0-0",
52+
"@typescript/native-preview": "^7.0.0-0"
5153
},
5254
"peerDependenciesMeta": {
5355
"@rsbuild/core": {
5456
"optional": true
57+
},
58+
"@typescript/native-preview": {
59+
"optional": true
5560
}
5661
},
5762
"packageManager": "pnpm@11.5.0",

0 commit comments

Comments
 (0)