From fec8b574bdef5508e5a4765569127d6713eeb4fa Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 26 Aug 2024 01:35:42 +0200 Subject: [PATCH] changesets: add changesets for type parameter changes Signed-off-by: Patrik Oldsberg --- .changeset/cool-melons-check.md | 21 +++++++++++++++++++++ .changeset/flat-kangaroos-push.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .changeset/cool-melons-check.md create mode 100644 .changeset/flat-kangaroos-push.md diff --git a/.changeset/cool-melons-check.md b/.changeset/cool-melons-check.md new file mode 100644 index 0000000000..462a023dca --- /dev/null +++ b/.changeset/cool-melons-check.md @@ -0,0 +1,21 @@ +--- +'@backstage/frontend-test-utils': patch +'@backstage/frontend-app-api': patch +'@backstage/core-compat-api': patch +'@backstage/plugin-catalog-import': patch +'@backstage/plugin-catalog-graph': patch +'@backstage/plugin-catalog-react': patch +'@backstage/plugin-user-settings': patch +'@backstage/plugin-search-react': patch +'@backstage/plugin-kubernetes': patch +'@backstage/plugin-scaffolder': patch +'@backstage/plugin-api-docs': patch +'@backstage/plugin-devtools': patch +'@backstage/plugin-techdocs': patch +'@backstage/plugin-catalog': patch +'@backstage/plugin-search': patch +'@backstage/plugin-home': patch +'@backstage/plugin-org': patch +--- + +Updated exports to use the new type parameters for extensions and extension blueprints. diff --git a/.changeset/flat-kangaroos-push.md b/.changeset/flat-kangaroos-push.md new file mode 100644 index 0000000000..b046beeeb1 --- /dev/null +++ b/.changeset/flat-kangaroos-push.md @@ -0,0 +1,31 @@ +--- +'@backstage/frontend-plugin-api': minor +--- + +**BREAKING**: Updated the type parameters for `ExtensionDefinition` and `ExtensionBlueprint` to only have a single object parameter. The base type parameter is exported as `ExtensionDefinitionParameters` and `ExtensionBlueprintParameters` respectively. This is shipped as an immediate breaking change as we expect usage of these types to be rare, and it does not affect the runtime behavior of the API. + +This is a breaking change as it changes the type parameters. Existing usage can generally be updated as follows: + +- `ExtensionDefinition` -> `ExtensionDefinition` +- `ExtensionDefinition` -> `ExtensionDefinition` +- `ExtensionDefinition` -> `ExtensionDefinition<{ config: TConfig }>` +- `ExtensionDefinition` -> `ExtensionDefinition<{ config: TConfig, configInput: TConfigInput }>` + +If you need to infer the parameter you can use `ExtensionDefinitionParameters`, for example: + +```ts +import { + ExtensionDefinition, + ExtensionDefinitionParameters, +} from '@backstage/frontend-plugin-api'; + +function myUtility( + ext: ExtensionDefinition, +): T['config'] { + // ... +} +``` + +The same patterns apply to `ExtensionBlueprint`. + +This change is made to improve the readability of API references and ability to evolve the type parameters in the future.