frontend-plugin-api: improve type errors for createFrontend{Plugin,Module}
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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.
|
||||
@@ -691,7 +691,7 @@ export interface CreateFrontendFeatureLoaderOptions {
|
||||
// @public
|
||||
export function createFrontendModule<
|
||||
TId extends string,
|
||||
TExtensions extends readonly ExtensionDefinition[] = [],
|
||||
TExtensions extends readonly ExtensionDefinition[],
|
||||
>(options: CreateFrontendModuleOptions<TId, TExtensions>): 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<TId, TRoutes, TExternalRoutes, TExtensions>,
|
||||
): OverridableFrontendPlugin<
|
||||
|
||||
@@ -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<TId, TExtensions>): FrontendModule {
|
||||
const { pluginId } = options;
|
||||
|
||||
|
||||
@@ -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<TId, TRoutes, TExternalRoutes, TExtensions>,
|
||||
): OverridableFrontendPlugin<
|
||||
|
||||
Reference in New Issue
Block a user