Renderer: align NitroConfig Window decl with client + fix glob .default access

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<string, unknown>' in its
  react-app-env.d.ts. The two declaration-merging fragments must
  match — switching the renderer side to Record<string, unknown>
  unifies them.
- packages/assets/src/AssetManager.ts: 'import.meta.glob(...)' is
  augmented as Record<string, string> 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.
This commit is contained in:
simoleo89
2026-05-11 21:34:47 +02:00
parent 22d4e5bfb0
commit f7a5897232
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -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, '');
+1 -1
View File
@@ -4,6 +4,6 @@ declare global
{
interface Window
{
NitroConfig?: { [index: string]: any };
NitroConfig?: Record<string, unknown>;
}
}