Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,8 @@ const defaultOptions = {
memoryLimit: 8192,
// use tsconfig of user project
configFile: tsconfigPath,
// use TypeScript checker by default
tsgo: false,
// use typescript of user project
typescriptPath: tsgo
? require.resolve('@typescript/native-preview/package.json')
: require.resolve('typescript'),
// resolve the default TypeScript package from user project
resolveRoot: api.context.rootPath,
},
issue: {
// ignore types errors from node_modules
Expand All @@ -134,17 +130,34 @@ const defaultOptions = {
// we only want to display error messages
},
error(message: string) {
console.error(message.replace(/ERROR/g, 'Type Error'));
console.error(
message
.replace(/ERROR/g, 'Type Error')
.replace(/WARNING/g, 'Type Warning'),
);
},
},
};
```

#### TypeScript Go support

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.
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 TypeScript Go checker binary for type checking and can reduce type-checking time by about 5-10x.

To enable it, install `@typescript/native-preview` and set `typescript.tsgo` to `true`:
Install TypeScript 7.0 RC to use TypeScript Go automatically:

```sh
# with npm
npm install -D typescript@rc

# with yarn
yarn add -D typescript@rc

# with pnpm
pnpm add -D typescript@rc
```

You can also install `@typescript/native-preview` and set `typescript.tsgo` to `true`:

```ts
pluginTypeCheck({
Expand All @@ -156,7 +169,9 @@ pluginTypeCheck({
});
```

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`.
When `tsgo` is enabled and `typescript.typescriptPath` is set manually, it must point to an absolute `typescript/package.json` path from TypeScript 7+ or `@typescript/native-preview/package.json`.

> The `@typescript/native-preview` usage is deprecated and kept only for compatibility. We recommend installing `typescript@rc` to use `tsgo`.

For supported options and limitations, see [ts-checker-rspack-plugin - TypeScript Go support](https://github.com/rstackjs/ts-checker-rspack-plugin#typescript-go-support).

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"deepmerge": "^4.3.1",
"json5": "^2.2.3",
"reduce-configs": "^1.1.2",
"ts-checker-rspack-plugin": "^1.4.0"
"ts-checker-rspack-plugin": "^1.5.1"
},
"devDependencies": {
"@playwright/test": "^1.61.1",
Expand Down
Loading