fix; types for custom card and preview

This commit is contained in:
Daniel Lautzenheiser 2023-04-21 13:04:56 -04:00
parent fbbbf64f53
commit 5629a15d3b

View File

@ -118,7 +118,10 @@ export function getPreviewStyles() {
/** /**
* Preview Templates * Preview Templates
*/ */
export function registerPreviewTemplate<T>(name: string, component: TemplatePreviewComponent<T>) { export function registerPreviewTemplate<T, EF extends BaseField = UnknownField>(
name: string,
component: TemplatePreviewComponent<T, EF>,
) {
registry.templates[name] = component as TemplatePreviewComponent<ObjectValue>; registry.templates[name] = component as TemplatePreviewComponent<ObjectValue>;
} }
@ -129,7 +132,10 @@ export function getPreviewTemplate(name: string): TemplatePreviewComponent<Objec
/** /**
* Preview Cards * Preview Cards
*/ */
export function registerPreviewCard<T>(name: string, component: TemplatePreviewCardComponent<T>) { export function registerPreviewCard<T, EF extends BaseField = UnknownField>(
name: string,
component: TemplatePreviewCardComponent<T, EF>,
) {
registry.cards[name] = component as TemplatePreviewCardComponent<ObjectValue>; registry.cards[name] = component as TemplatePreviewCardComponent<ObjectValue>;
} }