Change (fix) the typing of InputProps.onBlur() to FocusEvent (#38005)

This commit is contained in:
ulrichb 2019-09-03 22:23:33 +02:00 committed by Ron Buckton
parent 2db379b134
commit 6f4b17c37b
2 changed files with 3 additions and 1 deletions

View File

@ -7,6 +7,7 @@
// Christopher Deutsch <https://github.com/cdeutsch>
// Kevin Ross <https://github.com/rosskevin>
// Thomas den Hollander <https://github.com/ThomasdenH>
// ulrichb <https://github.com/ulrichb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@ -65,7 +66,7 @@ declare namespace Autosuggest {
interface InputProps<TSuggestion>
extends Omit<React.InputHTMLAttributes<any>, 'onChange' | 'onBlur'> {
onChange(event: React.FormEvent<any>, params: ChangeEvent): void;
onBlur?(event: React.FormEvent<any>, params?: BlurEvent<TSuggestion>): void;
onBlur?(event: React.FocusEvent<any>, params?: BlurEvent<TSuggestion>): void;
value: string;
[key: string]: any;
}

View File

@ -91,6 +91,7 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
placeholder: `Type 'c'`,
value,
onChange: (e, changeEvent) => this.onChange(e, changeEvent),
onBlur: (e) => { console.log(e.relatedTarget); }
}}
theme={theme}/>;
}