improve type handling for commands

This commit is contained in:
Philipp Kühn
2020-04-21 23:22:27 +02:00
parent 3deae61a15
commit 91d4aa7e39
13 changed files with 45 additions and 35 deletions

View File

@@ -21,7 +21,7 @@ import Node from './Node'
import Mark from './Mark'
import EventEmitter from './EventEmitter'
export type Command = (next: Function, editor: Editor, ...args: any) => any
export type Command = (next: Function, editor: Editor) => (...args: any) => any
export interface CommandSpec {
[key: string]: Command
@@ -104,7 +104,7 @@ export class Editor extends EventEmitter {
}
this.commands[name] = this.chainCommand((...args: any) => {
return new Promise(resolve => callback(resolve, this.proxy, ...args))
return new Promise(resolve => callback(resolve, this.proxy)(...args))
})
return this.proxy