1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-06 12:02:40 +03:00

Update typescript bits to aid matrix-react-sdk achieve noImplicitAny (#3079)

This commit is contained in:
Michael Telatynski
2023-02-03 14:01:53 +00:00
committed by GitHub
parent 44d2e47f96
commit e492a44dde
4 changed files with 11 additions and 9 deletions

View File

@@ -47,7 +47,7 @@ interface WellKnownConfig extends Omit<IWellKnownConfig, "error"> {
error?: IWellKnownConfig["error"] | null; error?: IWellKnownConfig["error"] | null;
} }
interface ClientConfig extends Omit<IClientWellKnown, "m.homeserver" | "m.identity_server"> { export interface ClientConfig extends Omit<IClientWellKnown, "m.homeserver" | "m.identity_server"> {
"m.homeserver": WellKnownConfig; "m.homeserver": WellKnownConfig;
"m.identity_server": WellKnownConfig; "m.identity_server": WellKnownConfig;
} }

View File

@@ -573,6 +573,8 @@ export interface IWellKnownConfig {
error?: Error | string; error?: Error | string;
// eslint-disable-next-line // eslint-disable-next-line
base_url?: string | null; base_url?: string | null;
// XXX: this is undocumented
server_name?: string;
} }
export interface IDelegatedAuthConfig { export interface IDelegatedAuthConfig {

View File

@@ -24,7 +24,7 @@ import { MatrixError } from "./http-api";
const EMAIL_STAGE_TYPE = "m.login.email.identity"; const EMAIL_STAGE_TYPE = "m.login.email.identity";
const MSISDN_STAGE_TYPE = "m.login.msisdn"; const MSISDN_STAGE_TYPE = "m.login.msisdn";
interface IFlow { export interface UIAFlow {
stages: AuthType[]; stages: AuthType[];
} }
@@ -48,8 +48,8 @@ export interface IAuthData {
session?: string; session?: string;
type?: string; type?: string;
completed?: string[]; completed?: string[];
flows?: IFlow[]; flows?: UIAFlow[];
available_flows?: IFlow[]; available_flows?: UIAFlow[];
stages?: string[]; stages?: string[];
required_stages?: AuthType[]; required_stages?: AuthType[];
params?: Record<string, Record<string, any>>; params?: Record<string, Record<string, any>>;
@@ -101,7 +101,7 @@ class NoAuthFlowFoundError extends Error {
public name = "NoAuthFlowFoundError"; public name = "NoAuthFlowFoundError";
// eslint-disable-next-line @typescript-eslint/naming-convention, camelcase // eslint-disable-next-line @typescript-eslint/naming-convention, camelcase
public constructor(m: string, public readonly required_stages: string[], public readonly flows: IFlow[]) { public constructor(m: string, public readonly required_stages: string[], public readonly flows: UIAFlow[]) {
super(m); super(m);
} }
} }
@@ -198,7 +198,7 @@ export class InteractiveAuth {
private emailSid?: string; private emailSid?: string;
private requestingEmailToken = false; private requestingEmailToken = false;
private attemptAuthDeferred: IDeferred<IAuthData> | null = null; private attemptAuthDeferred: IDeferred<IAuthData> | null = null;
private chosenFlow: IFlow | null = null; private chosenFlow: UIAFlow | null = null;
private currentStage: string | null = null; private currentStage: string | null = null;
private emailAttempt = 1; private emailAttempt = 1;
@@ -320,7 +320,7 @@ export class InteractiveAuth {
return this.data.params?.[loginType]; return this.data.params?.[loginType];
} }
public getChosenFlow(): IFlow | null { public getChosenFlow(): UIAFlow | null {
return this.chosenFlow; return this.chosenFlow;
} }
@@ -573,7 +573,7 @@ export class InteractiveAuth {
* @returns flow * @returns flow
* @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found * @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found
*/ */
private chooseFlow(): IFlow { private chooseFlow(): UIAFlow {
const flows = this.data.flows || []; const flows = this.data.flows || [];
// we've been given an email or we've already done an email part // we've been given an email or we've already done an email part
@@ -610,7 +610,7 @@ export class InteractiveAuth {
* @internal * @internal
* @returns login type * @returns login type
*/ */
private firstUncompletedStage(flow: IFlow): AuthType | undefined { private firstUncompletedStage(flow: UIAFlow): AuthType | undefined {
const completed = this.data.completed || []; const completed = this.data.completed || [];
return flow.stages.find((stageType) => !completed.includes(stageType)); return flow.stages.find((stageType) => !completed.includes(stageType));
} }