From 8d8267e37b0a2a29dfe584026c6d333ed10a3a4e Mon Sep 17 00:00:00 2001 From: "fuzeone-bot[bot]" Date: Tue, 18 Aug 2026 00:46:30 +0300 Subject: [PATCH] fix(fuzequality): cast the MF shared config so the image type-checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression from #701. Adding `singleton: true` to FuzeQuality's federation `shared` config broke the frontend image build: apps/web/vite.config.ts(30,18): error TS2322: Type '{ react: { singleton: true; requiredVersion: string; }; ... }' is not assignable to type 'Shared' Root cause, confirmed against the installed types: in @originjs/vite-plugin-federation@1.4.1, `SharedConfig.singleton` is COMMENTED OUT of types/index.d.ts (`// singleton?: boolean`) while `requiredVersion` is declared, so the object literal fails excess-property checking. The plugin honours `singleton` at runtime; only its types omit it. This is exactly why the host casts (frontend/vite.config.ts:187-188). Mirrored verbatim, including the `as any`, since the whole point of that block is to match the host's shared config EXACTLY — a mismatch means the remote loads its own React and dies on "Invalid hook call". Verified against the real 1.4.1 types: without the cast tsc reports TS2353 ("'singleton' does not exist in type 'SharedConfig'") on both entries; with the cast it is clean. Co-Authored-By: Claude Opus 5 Claude-Session-Id: 4b12627d-2bf2-43b5-be80-38cd5c2c3f6b --- FuzeQuality/apps/web/vite.config.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/FuzeQuality/apps/web/vite.config.ts b/FuzeQuality/apps/web/vite.config.ts index 6ed2758fa..74d07a677 100644 --- a/FuzeQuality/apps/web/vite.config.ts +++ b/FuzeQuality/apps/web/vite.config.ts @@ -26,9 +26,15 @@ export default defineConfig({ // `singleton: true`, or on a different major range, this remote loads its // own React copy across the federation boundary and dies at runtime on // "Invalid hook call" — in the browser, with nothing in CI to catch it. + // + // The `as any` casts mirror the host verbatim: @originjs/vite-plugin- + // federation@1.4.1 types `shared` as `Shared`, which does not admit this + // per-package object form even though the plugin consumes it at runtime. + // Dropping the casts fails `tsc --noEmit` with TS2322 and takes the whole + // image build down at the Dockerfile's type-check step. shared: { - react: { singleton: true, requiredVersion: '^19.0.0' }, - 'react-dom': { singleton: true, requiredVersion: '^19.0.0' }, + react: { singleton: true, requiredVersion: '^19.0.0' } as any, + 'react-dom': { singleton: true, requiredVersion: '^19.0.0' } as any, }, }), ],