diff --git a/.changeset/fine-hands-think.md b/.changeset/fine-hands-think.md new file mode 100644 index 0000000000..0fa99c904c --- /dev/null +++ b/.changeset/fine-hands-think.md @@ -0,0 +1,5 @@ +--- +'@backstage/frontend-plugin-api': patch +--- + +Improved the types of `createFrontendPlugin` and `createFrontendModule` so that errors due to incompatible options are indicated more clearly. diff --git a/packages/frontend-plugin-api/report.api.md b/packages/frontend-plugin-api/report.api.md index 9b9d9f99d7..e6259c70d7 100644 --- a/packages/frontend-plugin-api/report.api.md +++ b/packages/frontend-plugin-api/report.api.md @@ -691,7 +691,7 @@ export interface CreateFrontendFeatureLoaderOptions { // @public export function createFrontendModule< TId extends string, - TExtensions extends readonly ExtensionDefinition[] = [], + TExtensions extends readonly ExtensionDefinition[], >(options: CreateFrontendModuleOptions): FrontendModule; // @public (undocumented) @@ -710,13 +710,13 @@ export interface CreateFrontendModuleOptions< // @public export function createFrontendPlugin< TId extends string, + TExtensions extends readonly ExtensionDefinition[], TRoutes extends { [name in string]: RouteRef | SubRouteRef; } = {}, TExternalRoutes extends { [name in string]: ExternalRouteRef; } = {}, - TExtensions extends readonly ExtensionDefinition[] = [], >( options: PluginOptions, ): OverridableFrontendPlugin< diff --git a/packages/frontend-plugin-api/src/wiring/createFrontendModule.ts b/packages/frontend-plugin-api/src/wiring/createFrontendModule.ts index 7921f98635..cea0760e68 100644 --- a/packages/frontend-plugin-api/src/wiring/createFrontendModule.ts +++ b/packages/frontend-plugin-api/src/wiring/createFrontendModule.ts @@ -86,7 +86,7 @@ export interface InternalFrontendModule extends FrontendModule { */ export function createFrontendModule< TId extends string, - TExtensions extends readonly ExtensionDefinition[] = [], + TExtensions extends readonly ExtensionDefinition[], >(options: CreateFrontendModuleOptions): FrontendModule { const { pluginId } = options; diff --git a/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.ts b/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.ts index 49c173912a..5555a0b47c 100644 --- a/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.ts +++ b/packages/frontend-plugin-api/src/wiring/createFrontendPlugin.ts @@ -182,9 +182,9 @@ export interface PluginOptions< */ export function createFrontendPlugin< TId extends string, + TExtensions extends readonly ExtensionDefinition[], TRoutes extends { [name in string]: RouteRef | SubRouteRef } = {}, TExternalRoutes extends { [name in string]: ExternalRouteRef } = {}, - TExtensions extends readonly ExtensionDefinition[] = [], >( options: PluginOptions, ): OverridableFrontendPlugin<