Conform more code to strictNullChecks
(#10444
* Conform more code to `strictNullChecks` * Fix tests * Fix tests
This commit is contained in:
parent
ba2608ec74
commit
c225b8ec29
29 changed files with 85 additions and 75 deletions
|
@ -27,17 +27,17 @@ enum Phases {
|
|||
|
||||
interface IProps {
|
||||
onValueChanged?: (value: string, shouldSubmit: boolean) => void;
|
||||
initialValue?: string;
|
||||
label?: string;
|
||||
placeholder?: string;
|
||||
className?: string;
|
||||
initialValue: string;
|
||||
label: string;
|
||||
placeholder: string;
|
||||
className: string;
|
||||
labelClassName?: string;
|
||||
placeholderClassName?: string;
|
||||
placeholderClassName: string;
|
||||
// Overrides blurToSubmit if true
|
||||
blurToCancel?: boolean;
|
||||
// Will cause onValueChanged(value, true) to fire on blur
|
||||
blurToSubmit?: boolean;
|
||||
editable?: boolean;
|
||||
blurToSubmit: boolean;
|
||||
editable: boolean;
|
||||
}
|
||||
|
||||
interface IState {
|
||||
|
@ -109,11 +109,11 @@ export default class EditableText extends React.Component<IProps, IState> {
|
|||
this.value = this.props.initialValue;
|
||||
this.showPlaceholder(!this.value);
|
||||
this.onValueChanged(false);
|
||||
this.editableDiv.current.blur();
|
||||
this.editableDiv.current?.blur();
|
||||
};
|
||||
|
||||
private onValueChanged = (shouldSubmit: boolean): void => {
|
||||
this.props.onValueChanged(this.value, shouldSubmit);
|
||||
this.props.onValueChanged?.(this.value, shouldSubmit);
|
||||
};
|
||||
|
||||
private onKeyDown = (ev: React.KeyboardEvent<HTMLDivElement>): void => {
|
||||
|
@ -171,7 +171,7 @@ export default class EditableText extends React.Component<IProps, IState> {
|
|||
|
||||
private onFinish = (
|
||||
ev: React.KeyboardEvent<HTMLDivElement> | React.FocusEvent<HTMLDivElement>,
|
||||
shouldSubmit?: boolean,
|
||||
shouldSubmit = false,
|
||||
): void => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
||||
const self = this;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue