You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
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:
@@ -227,7 +227,7 @@ export class AssetManager implements IAssetManager
|
|||||||
for(const path in merged)
|
for(const path in merged)
|
||||||
{
|
{
|
||||||
const mod = merged[path];
|
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 file = path.split('/').pop()!;
|
||||||
const rawName = file.replace(/\.png$/i, '');
|
const rawName = file.replace(/\.png$/i, '');
|
||||||
@@ -296,7 +296,7 @@ export class AssetManager implements IAssetManager
|
|||||||
if(!path.startsWith(prefix)) continue;
|
if(!path.startsWith(prefix)) continue;
|
||||||
|
|
||||||
const mod = allImages[path];
|
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 file = path.split('/').pop()!;
|
||||||
const rawName = file.replace(/\.png$/i, '');
|
const rawName = file.replace(/\.png$/i, '');
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ export { };
|
|||||||
|
|
||||||
declare global
|
declare global
|
||||||
{
|
{
|
||||||
interface Window
|
interface Window
|
||||||
{
|
{
|
||||||
NitroConfig?: { [index: string]: any };
|
NitroConfig?: Record<string, unknown>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user