add possibility of null return value from RichUtils.handleKeyCommand (#18277)

* add possibility of null return from RichUtils.handleKeyCommand

* more specifically, the function returns null in the overload case

* make key for RichUtils.toggleLink potentially null

* add definitions by credit
This commit is contained in:
Willis Plummer
2017-07-21 12:40:00 -04:00
committed by Wesley Wigham
parent 1be93dbab9
commit 168bb317b1

View File

@@ -5,6 +5,7 @@
// Yale Cason <https://github.com/ghotiphud>
// Ryan Schwers <https://github.com/schwers>
// Michael Wu <https://github.com/michael-yx-wu>
// Willis Plummer <https://github.com/willisplummer>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -863,7 +864,7 @@ declare namespace Draft {
static getDataObjectForLinkURL(uri: URI): Object;
static handleKeyCommand(editorState: EditorState, command: DraftEditorCommand): EditorState;
static handleKeyCommand(editorState: EditorState, command: string): EditorState;
static handleKeyCommand(editorState: EditorState, command: string): null;
static insertSoftNewline(editorState: EditorState): EditorState;
@@ -888,7 +889,7 @@ declare namespace Draft {
*/
static toggleInlineStyle(editorState: EditorState, inlineStyle: string): EditorState;
static toggleLink(editorState: EditorState, targetSelection: SelectionState, entityKey: string): EditorState;
static toggleLink(editorState: EditorState, targetSelection: SelectionState, entityKey: string | null): EditorState;
/**
* When a collapsed cursor is at the start of an empty styled block, allow