changesets: add changesets for type parameter changes
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -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.
|
||||
@@ -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<any>` -> `ExtensionDefinition`
|
||||
- `ExtensionDefinition<any, any>` -> `ExtensionDefinition`
|
||||
- `ExtensionDefinition<TConfig>` -> `ExtensionDefinition<{ config: TConfig }>`
|
||||
- `ExtensionDefinition<TConfig, TConfigInput>` -> `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<T extends ExtensionDefinitionParameters>(
|
||||
ext: ExtensionDefinition<T>,
|
||||
): 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.
|
||||
Reference in New Issue
Block a user