From 02a19165a67b0e5da5916199b0cefad417f5c183 Mon Sep 17 00:00:00 2001 From: Stefano Verna Date: Tue, 16 Jul 2024 13:06:30 +0200 Subject: [PATCH] Extend types --- src/components/StructuredText/index.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/components/StructuredText/index.ts b/src/components/StructuredText/index.ts index edcf476..f399129 100644 --- a/src/components/StructuredText/index.ts +++ b/src/components/StructuredText/index.ts @@ -75,18 +75,27 @@ export function appendKeyToValidElement( return element; } -export type RenderInlineRecordContext = { - record: StructuredTextGraphQlResponseRecord; +export type RenderInlineRecordContext< + R extends + StructuredTextGraphQlResponseRecord = StructuredTextGraphQlResponseRecord, +> = { + record: R; }; -export type RenderRecordLinkContext = { - record: StructuredTextGraphQlResponseRecord; +export type RenderRecordLinkContext< + R extends + StructuredTextGraphQlResponseRecord = StructuredTextGraphQlResponseRecord, +> = { + record: R; children: RenderResult[]; transformedMeta: TransformedMeta; }; -export type RenderBlockContext = { - record: StructuredTextGraphQlResponseRecord; +export type RenderBlockContext< + R extends + StructuredTextGraphQlResponseRecord = StructuredTextGraphQlResponseRecord, +> = { + record: R; }; export const StructuredText = defineComponent({