TypeScript Issue: shopify.app.extensions() fails to narrow types

Hi everyone,

I’m seeing a TypeScript regression in the @shopify/app-bridge-types package. The ExtensionInfo interface is not a proper discriminated union, making it impossible to narrow the activations property.

The Problem

Even after checking type === 'theme_app_extension', TypeScript cannot access properties like handle inside the activations array. It incorrectly defaults to the UiExtensionActivation type.

Example:

const extensions = await globalThis.shopify.app.extensions();
const themeExtension = extensions.find(ext => ext.type === 'theme_app_extension');

if (themeExtension) {
  themeExtension.activations.forEach((block) => {
    // Error: Property 'handle' does not exist on type 'UiExtensionActivation'.
    console.log(block.handle); 
  });
}

Why this happens

The ExtensionInfo interface uses a generic with a conditional type for activations:

activations: Type extends 'ui_extension' ? UiExtensionActivation[] : Type extends 'theme_app_extension' ? ThemeExtensionActivation[] : never;

Because this is an interface and not a union of distinct types, the activations property remains a broken union that cannot be narrowed by checking the type field.


Is this a known bug? It would be great if ExtensionInfo was refactored into a standard discriminated union so it works out of the box.