refactor: remove AnyObject type

This commit is contained in:
Philipp Kühn
2021-04-21 09:43:31 +02:00
parent d720d77e8d
commit 1c8ca95de2
64 changed files with 108 additions and 196 deletions

View File

@@ -1,6 +1,6 @@
import { NodeType } from 'prosemirror-model'
import getNodeType from '../helpers/getNodeType'
import { Command, RawCommands, AnyObject } from '../types'
import { Command, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands {
@@ -8,7 +8,7 @@ declare module '@tiptap/core' {
/**
* Insert a node at the current position.
*/
insertNode: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
insertNode: (typeOrName: string | NodeType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -1,6 +1,6 @@
import { lift as originalLift } from 'prosemirror-commands'
import { NodeType } from 'prosemirror-model'
import { Command, RawCommands, AnyObject } from '../types'
import { Command, RawCommands } from '../types'
import isNodeActive from '../helpers/isNodeActive'
import getNodeType from '../helpers/getNodeType'
@@ -10,7 +10,7 @@ declare module '@tiptap/core' {
/**
* Removes an existing wrap.
*/
lift: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
lift: (typeOrName: string | NodeType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -1,5 +1,5 @@
import { NodeType } from 'prosemirror-model'
import { Command, RawCommands, AnyObject } from '../types'
import { Command, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands {
@@ -7,7 +7,7 @@ declare module '@tiptap/core' {
/**
* Replaces text with a node.
*/
replace: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
replace: (typeOrName: string | NodeType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -1,11 +1,6 @@
import { NodeType } from 'prosemirror-model'
import getNodeType from '../helpers/getNodeType'
import {
Command,
RawCommands,
Range,
AnyObject,
} from '../types'
import { Command, RawCommands, Range } from '../types'
declare module '@tiptap/core' {
interface Commands {
@@ -13,7 +8,7 @@ declare module '@tiptap/core' {
/**
* Replaces text with a node within a range.
*/
replaceRange: (range: Range, typeOrName: string | NodeType, attributes?: AnyObject) => Command,
replaceRange: (range: Range, typeOrName: string | NodeType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -1,11 +1,6 @@
import { TextSelection } from 'prosemirror-state'
import createDocument from '../helpers/createDocument'
import {
AnyObject,
Command,
RawCommands,
Content,
} from '../types'
import { Command, RawCommands, Content } from '../types'
declare module '@tiptap/core' {
interface Commands {
@@ -16,7 +11,7 @@ declare module '@tiptap/core' {
setContent: (
content: Content,
emitUpdate?: Boolean,
parseOptions?: AnyObject,
parseOptions?: Record<string, any>,
) => Command,
}
}

View File

@@ -1,5 +1,5 @@
import { MarkType } from 'prosemirror-model'
import { AnyObject, Command, RawCommands } from '../types'
import { Command, RawCommands } from '../types'
import getMarkType from '../helpers/getMarkType'
import getMarkAttributes from '../helpers/getMarkAttributes'
@@ -9,7 +9,7 @@ declare module '@tiptap/core' {
/**
* Add a mark with new attributes.
*/
setMark: (typeOrName: string | MarkType, attributes?: AnyObject) => Command,
setMark: (typeOrName: string | MarkType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -1,6 +1,6 @@
import { NodeType } from 'prosemirror-model'
import { setBlockType } from 'prosemirror-commands'
import { AnyObject, Command, RawCommands } from '../types'
import { Command, RawCommands } from '../types'
import getNodeType from '../helpers/getNodeType'
declare module '@tiptap/core' {
@@ -9,7 +9,7 @@ declare module '@tiptap/core' {
/**
* Replace a given range with a node.
*/
setNode: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
setNode: (typeOrName: string | NodeType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -1,5 +1,5 @@
import { MarkType } from 'prosemirror-model'
import { AnyObject, Command, RawCommands } from '../types'
import { Command, RawCommands } from '../types'
import getMarkType from '../helpers/getMarkType'
import isMarkActive from '../helpers/isMarkActive'
@@ -9,7 +9,7 @@ declare module '@tiptap/core' {
/**
* Toggle a mark on and off.
*/
toggleMark: (typeOrName: string | MarkType, attributes?: AnyObject) => Command,
toggleMark: (typeOrName: string | MarkType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -1,5 +1,5 @@
import { NodeType } from 'prosemirror-model'
import { AnyObject, Command, RawCommands } from '../types'
import { Command, RawCommands } from '../types'
import isNodeActive from '../helpers/isNodeActive'
import getNodeType from '../helpers/getNodeType'
@@ -9,7 +9,7 @@ declare module '@tiptap/core' {
/**
* Toggle a node with another node.
*/
toggleNode: (typeOrName: string | NodeType, toggleTypeOrName: string | NodeType, attributes?: AnyObject) => Command,
toggleNode: (typeOrName: string | NodeType, toggleTypeOrName: string | NodeType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -1,6 +1,6 @@
import { wrapIn, lift } from 'prosemirror-commands'
import { NodeType } from 'prosemirror-model'
import { AnyObject, Command, RawCommands } from '../types'
import { Command, RawCommands } from '../types'
import isNodeActive from '../helpers/isNodeActive'
import getNodeType from '../helpers/getNodeType'
@@ -10,7 +10,7 @@ declare module '@tiptap/core' {
/**
* Wraps nodes in another node, or removes an existing wrap.
*/
toggleWrap: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
toggleWrap: (typeOrName: string | NodeType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -2,7 +2,7 @@ import { NodeType, MarkType } from 'prosemirror-model'
import getNodeType from '../helpers/getNodeType'
import getMarkType from '../helpers/getMarkType'
import getSchemaTypeNameByName from '../helpers/getSchemaTypeNameByName'
import { AnyObject, Command, RawCommands } from '../types'
import { Command, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands {
@@ -10,7 +10,7 @@ declare module '@tiptap/core' {
/**
* Update attributes of a node or mark.
*/
updateAttributes: (typeOrName: string | NodeType | MarkType, attributes: AnyObject) => Command,
updateAttributes: (typeOrName: string | NodeType | MarkType, attributes: Record<string, any>) => Command,
}
}
}

View File

@@ -1,6 +1,6 @@
import { NodeType } from 'prosemirror-model'
import getNodeType from '../helpers/getNodeType'
import { AnyObject, Command, RawCommands } from '../types'
import { Command, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands {
@@ -8,7 +8,7 @@ declare module '@tiptap/core' {
/**
* Update attributes of a node.
*/
updateNodeAttributes: (typeOrName: string | NodeType, attributes: AnyObject) => Command,
updateNodeAttributes: (typeOrName: string | NodeType, attributes: Record<string, any>) => Command,
}
}
}

View File

@@ -1,6 +1,6 @@
import { wrapIn as originalWrapIn } from 'prosemirror-commands'
import { NodeType } from 'prosemirror-model'
import { AnyObject, Command, RawCommands } from '../types'
import { Command, RawCommands } from '../types'
import isNodeActive from '../helpers/isNodeActive'
import getNodeType from '../helpers/getNodeType'
@@ -10,7 +10,7 @@ declare module '@tiptap/core' {
/**
* Wraps nodes in another node.
*/
wrapIn: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
wrapIn: (typeOrName: string | NodeType, attributes?: Record<string, any>) => Command,
}
}
}

View File

@@ -1,6 +1,6 @@
import { wrapInList as originalWrapInList } from 'prosemirror-schema-list'
import { NodeType } from 'prosemirror-model'
import { AnyObject, Command, RawCommands } from '../types'
import { Command, RawCommands } from '../types'
import getNodeType from '../helpers/getNodeType'
declare module '@tiptap/core' {
@@ -9,7 +9,7 @@ declare module '@tiptap/core' {
/**
* Wrap a node in a list.
*/
wrapInList: (typeOrName: string | NodeType, attributes?: AnyObject) => Command,
wrapInList: (typeOrName: string | NodeType, attributes?: Record<string, any>) => Command,
}
}
}