diff --git a/.changeset/unlucky-cows-rush.md b/.changeset/unlucky-cows-rush.md new file mode 100644 index 0000000000..70e69dd62e --- /dev/null +++ b/.changeset/unlucky-cows-rush.md @@ -0,0 +1,5 @@ +--- +'@penumbra-zone/client': minor +--- + +improve manifest type diff --git a/apps/minifront/src/components/header/menu/provider.tsx b/apps/minifront/src/components/header/menu/provider.tsx index dd76a79019..417b379406 100644 --- a/apps/minifront/src/components/header/menu/provider.tsx +++ b/apps/minifront/src/components/header/menu/provider.tsx @@ -33,7 +33,7 @@ export const ProviderMenu = () => { id='provider-icon' className={cn('w-[1.5em]', 'max-w-none', 'h-[1.5em]')} src={URL.createObjectURL(penumbra.manifest.icons['128'])} - alt={`${penumbra.manifest['name']} Icon`} + alt={`${penumbra.manifest.name} Icon`} /> {chainId} @@ -43,9 +43,9 @@ export const ProviderMenu = () => {
- {penumbra.manifest['name']} {penumbra.manifest['version']} + {penumbra.manifest.name} {penumbra.manifest.version} -

{penumbra.manifest['description']}

+

{penumbra.manifest.description}

diff --git a/packages/client/src/manifest.ts b/packages/client/src/manifest.ts index 4b1c8e80dc..6d8d03a215 100644 --- a/packages/client/src/manifest.ts +++ b/packages/client/src/manifest.ts @@ -17,11 +17,14 @@ * * @see https://web.archive.org/web/20120606044635/http://supercollider.dk/2010/01/calculating-chrome-extension-id-from-your-private-key-233 */ -export type PenumbraManifestJson = Partial & - Required>; +export type PenumbraManifestJson = chrome.runtime.ManifestV3 & { + [k in 'name' | 'version' | 'description' | 'icons']-?: NonNullable; +}; + +type IconBlobs = { [size in `${number}`]?: Blob } & { [size128 in `${128}`]-?: NonNullable }; -export type PenumbraManifest = Omit & { - ['icons']: { '128': Blob } & Record<`${number}`, Blob>; +export type PenumbraManifest = { + [k in keyof PenumbraManifestJson]: k extends 'icons' ? IconBlobs : PenumbraManifestJson[k]; }; export const isPenumbraManifestJson = (mf: unknown): mf is PenumbraManifestJson =>