Apply strictNullChecks to src/components/views/auth/* (#10299

* Apply `strictNullChecks` to src/components/views/auth/*

* Iterate PR
This commit is contained in:
Michael Telatynski 2023-03-07 10:45:55 +00:00 committed by GitHub
parent c79eff2292
commit 32aa18ff2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 127 additions and 122 deletions

View file

@ -80,7 +80,7 @@ interface IProps {
// Called when the stage changes, or the stage's phase changes. First
// argument is the stage, second is the phase. Some stages do not have
// phases and will be counted as 0 (numeric).
onStagePhaseChange?(stage: AuthType, phase: number): void;
onStagePhaseChange?(stage: AuthType | null, phase: number): void;
}
interface IState {
@ -170,7 +170,8 @@ export default class InteractiveAuthComponent extends React.Component<IProps, IS
busy: true,
});
try {
return await this.props.requestEmailToken(email, secret, attempt, session);
// We know this method only gets called on flows where requestEmailToken is passed but types don't
return await this.props.requestEmailToken!(email, secret, attempt, session);
} finally {
this.setState({
busy: false,
@ -231,7 +232,7 @@ export default class InteractiveAuthComponent extends React.Component<IProps, IS
};
private onPhaseChange = (newPhase: number): void => {
this.props.onStagePhaseChange?.(this.state.authStage, newPhase || 0);
this.props.onStagePhaseChange?.(this.state.authStage ?? null, newPhase || 0);
};
private onStageCancel = (): void => {