Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(provider-logo): handle Next.js vs vite PNG import shape divergence

Jiang Bohanf26bdffaf253
diff --git a/packages/views/assets.d.ts b/packages/views/assets.d.ts
index 812d21129e..3b2b2b47b6 100644
--- a/packages/views/assets.d.ts
+++ b/packages/views/assets.d.ts
@@ -1,11 +1,22 @@
-// Asset imports — modern bundlers (Next.js / electron-vite / vite) resolve
-// these to a URL string at build time. This file lets TypeScript accept
-// `import logo from "./logo.png"` inside the shared package.
+// Asset imports — modern bundlers resolve these to a URL at build time,
+// but the exact shape differs between consumers:
+// - electron-vite / plain vite: a `string` URL
+// - Next.js (apps/web): a `StaticImageData` object with `.src`, plus
+// width/height/blurDataURL
+// Declare the union here so packages/views compiles in both contexts.
+// Component code should normalise with `typeof x === "string" ? x : x.src`.
+interface StaticImageAsset {
+ src: string;
+ height?: number;
+ width?: number;
+ blurDataURL?: string;
+}
+
declare module "*.png" {
- const src: string;
+ const src: string | StaticImageAsset;
export default src;
}
declare module "*.svg" {
- const src: string;
+ const src: string | StaticImageAsset;
export default src;
}
diff --git a/packages/views/runtimes/components/provider-logo.tsx b/packages/views/runtimes/components/provider-logo.tsx
index 6a087851e3..4b1224533e 100644
--- a/packages/views/runtimes/components/provider-logo.tsx
+++ b/packages/views/runtimes/components/provider-logo.tsx
@@ -139,12 +139,18 @@ function GeminiLogo({ className }: { className: string }) {
}
// Antigravity (Google) — official mark, shipped as a PNG asset next to
-// this file. Bundler (Next.js / electron-vite) resolves the import to a
-// URL string at build time.
+// this file. Different bundlers type the PNG import differently — Next.js
+// gives a StaticImageData object (.src), electron-vite + plain vite give
+// a string. Normalise via unknown so neither side's narrower type wins
+// and breaks the other's typecheck.
import antigravityLogo from "./antigravity-logo.png";
+const antigravityLogoSrc: string = (() => {
+ const asset = antigravityLogo as unknown;
+ return typeof asset === "string" ? asset : (asset as { src: string }).src;
+})();
function AntigravityLogo({ className }: { className: string }) {
- return <img src={antigravityLogo} alt="Antigravity" className={className} />;
+ return <img src={antigravityLogoSrc} alt="Antigravity" className={className} />;
}
// Kiro CLI — official icon sourced from kiro.dev/icon.svg.