Skip to content

Commit ede0fa4

Browse files
authored
chore: update readme
1 parent 44ea5dc commit ede0fa4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import { createSyncFn } from 'synckit'
5353

5454
// the worker path must be absolute
5555
const syncFn = createSyncFn(require.resolve('./worker'), {
56-
tsRunner: 'tsx', // optional, can be `'ts-node' | 'esbuild-register' | 'esbuild-runner' | 'tsx'`
56+
tsRunner: 'tsx', // optional, can be `'node' | 'ts-node' | 'esbuild-register' | 'esbuild-runner' | 'tsx'`
5757
})
5858

5959
// do whatever you want, you will get the result synchronously!
@@ -126,9 +126,17 @@ export interface GlobalShim {
126126

127127
### TypeScript
128128

129-
#### `ts-node`
129+
#### `node` (Default, Node 23+)
130130

131-
If you want to use `ts-node` for worker file (a `.ts` file), it is supported out of box!
131+
On recent Node versions, you may select this runner to execute your worker file (a `.ts` file) in the native runtime.
132+
133+
As of Node v23, this feature is supported out of the box. To enable it in the current LTS, you can pass the [`--experimental-strip-types`](https://nodejs.org/docs/latest-v22.x/api/typescript.html#type-stripping) flag to the process. Visit the [documentation](https://nodejs.org/docs/latest/api/typescript.html#type-stripping) to learn more.
134+
135+
When `synckit` detects the process to be running with this flag, it will execute the worker file with the `node` runner by default.
136+
137+
#### `ts-node` (Default)
138+
139+
Prior to Node v23, you may want to use `ts-node` to execute your worker file (a `.ts` file).
132140

133141
If you want to use a custom tsconfig as project instead of default `tsconfig.json`, use `TS_NODE_PROJECT` env. Please view [ts-node](https://github.com/TypeStrong/ts-node#tsconfig) for more details.
134142

0 commit comments

Comments
 (0)