simplify extension registry generics
This commit is contained in:
@@ -11,8 +11,8 @@ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
|
||||
/**
|
||||
*/
|
||||
export class UmbExtensionsElementInitializer<
|
||||
ManifestTypes extends ManifestBase,
|
||||
ManifestTypeName extends string = ManifestTypes['type'],
|
||||
ManifestTypes extends ManifestBase = ManifestBase,
|
||||
ManifestTypeName extends string = string,
|
||||
ManifestType extends ManifestBase = SpecificManifestTypeOrManifestBase<ManifestTypes, ManifestTypeName>,
|
||||
ControllerType extends UmbExtensionElementInitializer<ManifestType> = UmbExtensionElementInitializer<ManifestType>,
|
||||
MyPermittedControllerType extends ControllerType = PermittedControllerType<ControllerType>,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ManifestBase } from './manifest-base.interface.js';
|
||||
|
||||
export type ManifestTypeMap<ManifestTypes extends ManifestBase> = {
|
||||
type ManifestTypeMapGenerator<ManifestTypes extends ManifestBase> = {
|
||||
[Manifest in ManifestTypes as Manifest['type']]: Manifest;
|
||||
} & {
|
||||
[key: string]: ManifestBase;
|
||||
@@ -9,4 +9,5 @@ export type ManifestTypeMap<ManifestTypes extends ManifestBase> = {
|
||||
export type SpecificManifestTypeOrManifestBase<
|
||||
ManifestTypes extends ManifestBase,
|
||||
T extends string,
|
||||
> = T extends keyof ManifestTypeMap<ManifestTypes> ? ManifestTypeMap<ManifestTypes>[T] : ManifestBase;
|
||||
ManifestTypeMapType = ManifestTypeMapGenerator<ManifestTypes>,
|
||||
> = T extends keyof ManifestTypeMapType ? ManifestTypeMapType[T] : ManifestBase;
|
||||
|
||||
Reference in New Issue
Block a user