From f7a58972321c5e079a163b04a9a52299a7fcf5e7 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Mon, 11 May 2026 21:34:47 +0200 Subject: [PATCH] Renderer: align NitroConfig Window decl with client + fix glob .default access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two tsgo nits that propagate to the client when the renderer is linked in: - packages/utils/src/NitroConfig.ts declared 'NitroConfig?: { [index: string]: any }' on Window, but Nitro-V3 declares 'NitroConfig?: Record' in its react-app-env.d.ts. The two declaration-merging fragments must match — switching the renderer side to Record unifies them. - packages/assets/src/AssetManager.ts: 'import.meta.glob(...)' is augmented as Record in the client's typedef, so 'mod.default ?? mod' (defensive handling of either string or { default: string }) failed because mod is typed string. Cast inline: '((mod as { default?: string }).default ?? mod)'. Renderer tsgo error count: 3 -> 0. --- packages/assets/src/AssetManager.ts | 4 ++-- packages/utils/src/NitroConfig.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/assets/src/AssetManager.ts b/packages/assets/src/AssetManager.ts index ae27cbf..7d992f7 100644 --- a/packages/assets/src/AssetManager.ts +++ b/packages/assets/src/AssetManager.ts @@ -227,7 +227,7 @@ export class AssetManager implements IAssetManager for(const path in merged) { const mod = merged[path]; - const imageUrl = (mod.default ?? mod) as string; + const imageUrl = ((mod as { default?: string }).default ?? mod) as string; const file = path.split('/').pop()!; const rawName = file.replace(/\.png$/i, ''); @@ -296,7 +296,7 @@ export class AssetManager implements IAssetManager if(!path.startsWith(prefix)) continue; const mod = allImages[path]; - const imageUrl = (mod.default ?? mod) as string; + const imageUrl = ((mod as { default?: string }).default ?? mod) as string; const file = path.split('/').pop()!; const rawName = file.replace(/\.png$/i, ''); diff --git a/packages/utils/src/NitroConfig.ts b/packages/utils/src/NitroConfig.ts index aa905eb..aca544a 100644 --- a/packages/utils/src/NitroConfig.ts +++ b/packages/utils/src/NitroConfig.ts @@ -2,8 +2,8 @@ export { }; declare global { - interface Window - { - NitroConfig?: { [index: string]: any }; - } + interface Window + { + NitroConfig?: Record; + } }