From 168bb317b17e783adfaaeb3ea88a424030dbc488 Mon Sep 17 00:00:00 2001 From: Willis Plummer Date: Fri, 21 Jul 2017 12:40:00 -0400 Subject: [PATCH] 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 --- types/draft-js/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/draft-js/index.d.ts b/types/draft-js/index.d.ts index 1019df8fce..73c248df03 100644 --- a/types/draft-js/index.d.ts +++ b/types/draft-js/index.d.ts @@ -5,6 +5,7 @@ // Yale Cason // Ryan Schwers // Michael Wu +// Willis Plummer // 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