I am installing the latest Meteor version with rspack for the first time. rspack requires TypeScript 7, but TypeScript ESLint is not ready for this yet. Is there a workaround for this?
I also tried to install typescript/native-preview instead, as recommended in the command line, but this caused the Meteor server to shutdown and restart constantly.
There is a hack proposed in the TypeScript ESLint issues and on Microsoft’s website, which basically runs TypeScript 6 and 7 side-by-side. But this does not work with the rspack setup, because both ESLint and rspack expect the “typescript” package to point to the correct version. If rspack detects that this is v7, it takes it instead of @typescript/native. But this breaks eslint and vice versa.
Rspack itself doesn’t need TypeScript 7. It doesn’t need the typescript package at all. @rspack/core is the Rust binding, and TS/TSX goes through SWC’s own parser. Neither @rspack/core nor @meteorjs/rspack lists typescriptas a dependency or peer.
The only place I found Meteor touching it is the rspack package (packages/rspack/lib/dependencies.js). It checks whether a dependency named typescript appears in your package.json and, if so, sets METEOR_TYPESCRIPT_ENABLED so SWC parses .ts/.tsx. It doesn’t load the package or check its version. That means you can point typescript at TS6 for ESLint and still build with Rspack.
We run Meteor 3.5 with @meteorjs/rspack 2.2.0, ESLint 10 and typescript-eslint 8.70, and still type-check with TS7, using the dual alias Microsoft recommends:
typescript resolves to TS6, so typescript-eslint gets the compiler API it needs. (TS 7.0 doesn’t ship one, which is why ESLint crashes on load.)
@typescript/native is the Go-based TS7 for fast type checking. Because the alias moves .bin/tsc to TS6, call TS7’s binary directly through a script like tsc7 above.
Rspack doesn’t care which one typescript points to.
If something in your setup still insists on TS7 for the typescript name, check your rspack.config.js for a type-checking plugin (e.g. ts-checker-rspack-plugin), since that would load typescript itself. Also, which Meteor version prints the “install native-preview” hint? I haven’t seen it on 3.5, so it may be from a newer release.
I tested @permb’s suggestion on Meteor 3.6-rc.0 and got TS6, TS7 and ESLint working together.
We kept TS6 under the typescript package name for ESLint, installed TS7 as @typescript/native, and pointed ts-checker-rspack-plugin to its package.json using typescriptPath, with tsgo: true.
For the restart loop, we also merged #14769, which fixes a TypeScript/Rspack restart loop in the 3.6 release line. Could you confirm which Meteor version you’re using so we can check whether it includes that fix?
I didn’t see an idle restart loop in our demo, but TSX edits still reloaded the page and restarted the server. That behavior needs a separate look.
There is a bug in typescript 7.0 when you set it to watch and it will trigger a “0 files recompiled” whenever ANY file in a subdirectory changes. When you run locally with mongodb configured with .meteor/local/db this will create a lot of noise. We verified that this was fixed in 7.1dev but are waiting for the 7.1 beta before moving to it.
Quick follow-up on the TSX edits @italojs mentioned. I reproduced the server restart and page reload, and opened a PR for the Meteor side, based on release-3.6. It still needs review and a later release inclusion.
The type checker was triggering a server compilation when a client component changed. Rspack’s compilation hash changed, but the server output stayed identical. Meteor treated that as a server change and restarted, which also caused the browser to reload and lose React state.
The fix uses Rspack’s existing output-change information. Local checks are green: TSX edits preserve the counter, browser document, and server PID, and real server changes still restart correctly.
Also, this can help other Rspack projects with the same kind of unnecessary invalidation, regardless of language. It only changes development server restart tracking.
The TS 7.1 watch fix @permb mentioned is a separate issue. This PR addresses the Meteor restart behavior; the TS6/TS7 alias setup for ESLint still applies.
Awesome! Sounds great. Will try it as soon as I find some time. Would love to use rspack in my TS7 environment in combination with eslint, if that’s possible.