fix options type
This commit is contained in:
@@ -2,27 +2,31 @@ import { NodeSpec, NodeType } from 'prosemirror-model'
|
||||
import Extension, { ExtensionCallback, ExtensionExtends } from './Extension'
|
||||
import { Editor } from './Editor'
|
||||
|
||||
interface Callback {
|
||||
interface NodeCallback<Options> {
|
||||
name: string
|
||||
editor: Editor
|
||||
options: any
|
||||
options: Options
|
||||
type: NodeType
|
||||
}
|
||||
|
||||
export interface NodeExtends extends ExtensionExtends<Callback> {
|
||||
export interface NodeExtends<Callback, Options> extends ExtensionExtends<Callback, Options> {
|
||||
topNode: boolean
|
||||
schema: (params: Callback) => NodeSpec
|
||||
}
|
||||
|
||||
export default class Node<Options = {}> extends Extension<Options, Callback, NodeExtends> {
|
||||
export default class Node<
|
||||
Options = {},
|
||||
Callback = NodeCallback<Options>,
|
||||
Extends extends NodeExtends<Callback, Options> = NodeExtends<Callback, Options>
|
||||
> extends Extension<Options, Callback, Extends> {
|
||||
type = 'node'
|
||||
|
||||
public topNode(value: NodeExtends['topNode'] = true) {
|
||||
public topNode(value: Extends['topNode'] = true) {
|
||||
this.storeConfig('topNode', value, 'overwrite')
|
||||
return this
|
||||
}
|
||||
|
||||
public schema(value: NodeExtends['schema']) {
|
||||
public schema(value: Extends['schema']) {
|
||||
this.storeConfig('schema', value, 'overwrite')
|
||||
return this
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user