Skip to content

Commit

Permalink
fix: revert type changes introduced with 2.10 #5859 (#5860)
Browse files Browse the repository at this point in the history
* revert: "fix(core): update the typings to be that options and storage are partials on an extended config #5852 (#5854)"

This reverts commit 87d63d8.

* revert: "fix(core): update the typing of `addOptions`, `addStorage` to have an optional parent #5768 (#5770)"

This reverts commit d2f366d.
  • Loading branch information
nperez0111 authored Nov 22, 2024
1 parent 9d1c41e commit 9b1c66c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/Extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ declare module '@tiptap/core' {
*/
addOptions?: (this: {
name: string
parent: ParentConfig<ExtensionConfig<Options, Storage>>['addOptions']
parent: Exclude<ParentConfig<ExtensionConfig<Options, Storage>>['addOptions'], undefined>
}) => Options

/**
Expand All @@ -76,7 +76,7 @@ declare module '@tiptap/core' {
addStorage?: (this: {
name: string
options: Options
parent: ParentConfig<ExtensionConfig<Options, Storage>>['addStorage']
parent: Exclude<ParentConfig<ExtensionConfig<Options, Storage>>['addStorage'], undefined>
}) => Storage

/**
Expand Down Expand Up @@ -474,9 +474,9 @@ export class Extension<Options = any, Storage = any> {
}

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

extension.parent = this

Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/Mark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ declare module '@tiptap/core' {
*/
addOptions?: (this: {
name: string
parent: ParentConfig<MarkConfig<Options, Storage>>['addOptions']
parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addOptions'], undefined>
}) => Options

/**
Expand All @@ -79,7 +79,7 @@ declare module '@tiptap/core' {
addStorage?: (this: {
name: string
options: Options
parent: ParentConfig<MarkConfig<Options, Storage>>['addStorage']
parent: Exclude<ParentConfig<MarkConfig<Options, Storage>>['addStorage'], undefined>
}) => Storage

/**
Expand Down Expand Up @@ -606,9 +606,9 @@ export class Mark<Options = any, Storage = any> {
}

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

extension.parent = this

Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ declare module '@tiptap/core' {
*/
addOptions?: (this: {
name: string
parent: ParentConfig<NodeConfig<Options, Storage>>['addOptions']
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addOptions'], undefined>
}) => Options

/**
Expand All @@ -80,7 +80,7 @@ declare module '@tiptap/core' {
addStorage?: (this: {
name: string
options: Options
parent: ParentConfig<NodeConfig<Options, Storage>>['addStorage']
parent: Exclude<ParentConfig<NodeConfig<Options, Storage>>['addStorage'], undefined>
}) => Storage

/**
Expand Down Expand Up @@ -816,9 +816,9 @@ export class Node<Options = any, Storage = any> {
}

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

extension.parent = this

Expand Down

0 comments on commit 9b1c66c

Please sign in to comment.