Skip to content

Commit

Permalink
fix(core): update the typings to be that options and storage are part…
Browse files Browse the repository at this point in the history
…ials on an extended config #5852 (#5854)
  • Loading branch information
nperez0111 authored Nov 21, 2024
1 parent 4b2de33 commit 87d63d8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-panthers-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tiptap/core": patch
---

Update TypeScript types to allow options to be optional
4 changes: 2 additions & 2 deletions packages/core/src/Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,9 @@ export class Extension<Options = any, Storage = any> {
}

extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
extendedConfig: Partial<ExtensionConfig<ExtendedOptions, ExtendedStorage>> = {},
extendedConfig: Partial<ExtensionConfig<Partial<ExtendedOptions>, Partial<ExtendedStorage>>> = {},
) {
const extension = new Extension<ExtendedOptions, ExtendedStorage>({ ...this.config, ...extendedConfig })
const extension = new Extension<ExtendedOptions, ExtendedStorage>({ ...this.config, ...extendedConfig } as ExtensionConfig)

extension.parent = this

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Mark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,9 @@ export class Mark<Options = any, Storage = any> {
}

extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
extendedConfig: Partial<MarkConfig<ExtendedOptions, ExtendedStorage>> = {},
extendedConfig: Partial<MarkConfig<Partial<ExtendedOptions>, Partial<ExtendedStorage>>> = {},
) {
const extension = new Mark<ExtendedOptions, ExtendedStorage>(extendedConfig)
const extension = new Mark<ExtendedOptions, ExtendedStorage>(extendedConfig as MarkConfig)

extension.parent = this

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -816,9 +816,9 @@ export class Node<Options = any, Storage = any> {
}

extend<ExtendedOptions = Options, ExtendedStorage = Storage>(
extendedConfig: Partial<NodeConfig<ExtendedOptions, ExtendedStorage>> = {},
extendedConfig: Partial<NodeConfig<Partial<ExtendedOptions>, Partial<ExtendedStorage>>> = {},
) {
const extension = new Node<ExtendedOptions, ExtendedStorage>(extendedConfig)
const extension = new Node<ExtendedOptions, ExtendedStorage>(extendedConfig as NodeConfig)

extension.parent = this

Expand Down

0 comments on commit 87d63d8

Please sign in to comment.