From 59d6051d0534b1f584c8b421df8e70774b48a9ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Sat, 24 Oct 2020 00:09:58 +0200 Subject: [PATCH] improve attribute type --- packages/core/src/types.ts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index c7988c54..fe57f8ff 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -6,13 +6,12 @@ export type Extensions = (Extension | NodeExtension | MarkExtension)[] export type Attribute = { default: any, - rendered?: boolean, - renderHTML?: (attributes: { - [key: string]: any, - }) => any, - parseHTML?: (node: HTMLElement) => { - [key: string]: any, - }, + rendered?: false, +} | { + default: any, + rendered?: true, + renderHTML: (attributes: { [key: string]: any }) => any, + parseHTML: (node: HTMLElement) => { [key: string]: any }, } export type Attributes = { @@ -22,7 +21,12 @@ export type Attributes = { export type ExtensionAttribute = { type: string, name: string, - attribute: Required, + attribute: { + default: any, + rendered: boolean, + renderHTML: (attributes: { [key: string]: any }) => any, + parseHTML: (node: HTMLElement) => { [key: string]: any }, + }, } export type GlobalAttributes = {