Skip to content

Commit

Permalink
Update typescript bits to aid matrix-react-sdk achieve noImplicitAny (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Feb 3, 2023
1 parent 44d2e47 commit e492a44
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/autodiscovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface WellKnownConfig extends Omit<IWellKnownConfig, "error"> {
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.identity_server": WellKnownConfig;
}
Expand Down
2 changes: 2 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,8 @@ export interface IWellKnownConfig {
error?: Error | string;
// eslint-disable-next-line
base_url?: string | null;
// XXX: this is undocumented
server_name?: string;
}

export interface IDelegatedAuthConfig {
Expand Down
16 changes: 8 additions & 8 deletions src/interactive-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { MatrixError } from "./http-api";
const EMAIL_STAGE_TYPE = "m.login.email.identity";
const MSISDN_STAGE_TYPE = "m.login.msisdn";

interface IFlow {
export interface UIAFlow {
stages: AuthType[];
}

Expand All @@ -48,8 +48,8 @@ export interface IAuthData {
session?: string;
type?: string;
completed?: string[];
flows?: IFlow[];
available_flows?: IFlow[];
flows?: UIAFlow[];
available_flows?: UIAFlow[];
stages?: string[];
required_stages?: AuthType[];
params?: Record<string, Record<string, any>>;
Expand Down Expand Up @@ -101,7 +101,7 @@ class NoAuthFlowFoundError extends Error {
public name = "NoAuthFlowFoundError";

// 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);
}
}
Expand Down Expand Up @@ -198,7 +198,7 @@ export class InteractiveAuth {
private emailSid?: string;
private requestingEmailToken = false;
private attemptAuthDeferred: IDeferred<IAuthData> | null = null;
private chosenFlow: IFlow | null = null;
private chosenFlow: UIAFlow | null = null;
private currentStage: string | null = null;

private emailAttempt = 1;
Expand Down Expand Up @@ -320,7 +320,7 @@ export class InteractiveAuth {
return this.data.params?.[loginType];
}

public getChosenFlow(): IFlow | null {
public getChosenFlow(): UIAFlow | null {
return this.chosenFlow;
}

Expand Down Expand Up @@ -573,7 +573,7 @@ export class InteractiveAuth {
* @returns flow
* @throws {@link NoAuthFlowFoundError} If no suitable authentication flow can be found
*/
private chooseFlow(): IFlow {
private chooseFlow(): UIAFlow {
const flows = this.data.flows || [];

// we've been given an email or we've already done an email part
Expand Down Expand Up @@ -610,7 +610,7 @@ export class InteractiveAuth {
* @internal
* @returns login type
*/
private firstUncompletedStage(flow: IFlow): AuthType | undefined {
private firstUncompletedStage(flow: UIAFlow): AuthType | undefined {
const completed = this.data.completed || [];
return flow.stages.find((stageType) => !completed.includes(stageType));
}
Expand Down

0 comments on commit e492a44

Please sign in to comment.