From 87d63d8d1761138add50e05d584e6f24d99daf9c Mon Sep 17 00:00:00 2001 From: Nick Perez Date: Thu, 21 Nov 2024 14:39:13 +0100 Subject: [PATCH] fix(core): update the typings to be that options and storage are partials on an extended config #5852 (#5854) --- .changeset/fluffy-panthers-yell.md | 5 +++++ packages/core/src/Extension.ts | 4 ++-- packages/core/src/Mark.ts | 4 ++-- packages/core/src/Node.ts | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 .changeset/fluffy-panthers-yell.md diff --git a/.changeset/fluffy-panthers-yell.md b/.changeset/fluffy-panthers-yell.md new file mode 100644 index 000000000..1e763dfc9 --- /dev/null +++ b/.changeset/fluffy-panthers-yell.md @@ -0,0 +1,5 @@ +--- +"@tiptap/core": patch +--- + +Update TypeScript types to allow options to be optional diff --git a/packages/core/src/Extension.ts b/packages/core/src/Extension.ts index fa649aa34..ae5870837 100644 --- a/packages/core/src/Extension.ts +++ b/packages/core/src/Extension.ts @@ -474,9 +474,9 @@ export class Extension { } extend( - extendedConfig: Partial> = {}, + extendedConfig: Partial, Partial>> = {}, ) { - const extension = new Extension({ ...this.config, ...extendedConfig }) + const extension = new Extension({ ...this.config, ...extendedConfig } as ExtensionConfig) extension.parent = this diff --git a/packages/core/src/Mark.ts b/packages/core/src/Mark.ts index ea57edd7f..3200f705f 100644 --- a/packages/core/src/Mark.ts +++ b/packages/core/src/Mark.ts @@ -606,9 +606,9 @@ export class Mark { } extend( - extendedConfig: Partial> = {}, + extendedConfig: Partial, Partial>> = {}, ) { - const extension = new Mark(extendedConfig) + const extension = new Mark(extendedConfig as MarkConfig) extension.parent = this diff --git a/packages/core/src/Node.ts b/packages/core/src/Node.ts index 567e0eef7..05ef81539 100644 --- a/packages/core/src/Node.ts +++ b/packages/core/src/Node.ts @@ -816,9 +816,9 @@ export class Node { } extend( - extendedConfig: Partial> = {}, + extendedConfig: Partial, Partial>> = {}, ) { - const extension = new Node(extendedConfig) + const extension = new Node(extendedConfig as NodeConfig) extension.parent = this