From 02cc3207a80a1ed38460c3b7dd09ed1ae2dc4276 Mon Sep 17 00:00:00 2001 From: Christopher Manouvrier Date: Wed, 16 Jan 2019 17:32:39 +1100 Subject: [PATCH] fix(prosemirror-state): Improve the generic typings --- types/prosemirror-state/index.d.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/types/prosemirror-state/index.d.ts b/types/prosemirror-state/index.d.ts index 7ecf0f3c13..2db5ec4faa 100644 --- a/types/prosemirror-state/index.d.ts +++ b/types/prosemirror-state/index.d.ts @@ -33,7 +33,7 @@ export interface PluginSpec { * Allows a plugin to define a [state field](#state.StateField), an * extra slot in the state object in which it can keep its own data. */ - state?: StateField | null; + state?: StateField | null; /** * Can be used to make this a keyed plugin. You can have only one * plugin with a given key in a given state, but it is possible to @@ -60,7 +60,7 @@ export interface PluginSpec { * applied by the state, allowing the plugin to cancel it (by * returning false). */ - filterTransaction?: ((p1: Transaction, p2: EditorState) => boolean) | null; + filterTransaction?: ((p1: Transaction, p2: EditorState) => boolean) | null; /** * Allows the plugin to append another transaction to be applied * after the given array of transactions. When another plugin @@ -71,10 +71,10 @@ export interface PluginSpec { */ appendTransaction?: | (( - transactions: Transaction[], + transactions: Transaction[], oldState: EditorState, newState: EditorState - ) => Transaction | null | undefined | void) + ) => Transaction | null | undefined | void) | null; } /** @@ -120,7 +120,7 @@ export interface StateField { * constructed state does not yet contain the state from plugins * coming after this one. */ - apply(tr: Transaction, value: T, oldState: EditorState, newState: EditorState): T; + apply(tr: Transaction, value: T, oldState: EditorState, newState: EditorState): T; /** * Convert this field to JSON. Optional, can be left off to disable * JSON serialization for the field. @@ -223,12 +223,12 @@ export class Selection { * Replace the selection with a slice or, if no slice is given, * delete the selection. Will append to the given transaction. */ - replace(tr: Transaction, content?: Slice): void; + replace(tr: Transaction, content?: Slice): void; /** * Replace the selection with the given node, appending the changes * to the given transaction. */ - replaceWith(tr: Transaction, node: ProsemirrorNode): void; + replaceWith(tr: Transaction, node: ProsemirrorNode): void; /** * Convert the selection to a JSON representation. When implementing * this for a custom selection class, make sure to give the object a @@ -444,7 +444,7 @@ export class EditorState { /** * Apply the given transaction to produce a new state. */ - apply(tr: Transaction): EditorState; + apply(tr: Transaction): EditorState; /** * Verbose variant of [`apply`](#state.EditorState.apply) that * returns the precise transactions that were applied (which might @@ -452,11 +452,11 @@ export class EditorState { * hooks](#state.PluginSpec.filterTransaction) of * plugins) along with the new state. */ - applyTransaction(tr: Transaction): { state: EditorState; transactions: Transaction[] }; + applyTransaction(tr: Transaction): { state: EditorState; transactions: Transaction[] }; /** * Start a [transaction](#state.Transaction) from this state. */ - tr: Transaction; + tr: Transaction; /** * Create a new state based on this one, but with an adjusted set of * active plugins. State fields that exist in both sets of plugins