Appease the linter (and the project)

Also export the interface that the project expects to be able to import :|
pull/21833/head
Travis Ralston 2020-05-25 15:59:15 -06:00
parent bd2d13edd2
commit 0cec74cc2b
2 changed files with 12 additions and 12 deletions

View File

@ -34,7 +34,7 @@ import IdentityAuthClient from './IdentityAuthClient';
import { crossSigningCallbacks } from './CrossSigningManager'; import { crossSigningCallbacks } from './CrossSigningManager';
import {SHOW_QR_CODE_METHOD} from "matrix-js-sdk/src/crypto/verification/QRCode"; import {SHOW_QR_CODE_METHOD} from "matrix-js-sdk/src/crypto/verification/QRCode";
interface ICredentials { export interface IMatrixClientCreds {
homeserverUrl: string, homeserverUrl: string,
identityServerUrl: string, identityServerUrl: string,
userId: string, userId: string,
@ -57,20 +57,20 @@ interface IOpts {
* Matrix Client object is available easily. * Matrix Client object is available easily.
*/ */
class _MatrixClientPeg { class _MatrixClientPeg {
private matrixClient: MatrixClient;
private justRegisteredUserId: string;
// These are the default options used when when the // These are the default options used when when the
// client is started in 'start'. These can be altered // client is started in 'start'. These can be altered
// at any time up to after the 'will_start_client' // at any time up to after the 'will_start_client'
// event is finished processing. // event is finished processing.
private opts: IOpts = { public opts: IOpts = {
initialSyncLimit: 20, initialSyncLimit: 20,
}; };
private matrixClient: MatrixClient;
private justRegisteredUserId: string;
// the credentials used to init the current client object. // the credentials used to init the current client object.
// used if we tear it down & recreate it with a different store // used if we tear it down & recreate it with a different store
private currentClientCreds: ICredentials; private currentClientCreds: IMatrixClientCreds;
constructor() { constructor() {
} }
@ -125,9 +125,9 @@ class _MatrixClientPeg {
* Replace this MatrixClientPeg's client with a client instance that has * Replace this MatrixClientPeg's client with a client instance that has
* homeserver / identity server URLs and active credentials * homeserver / identity server URLs and active credentials
* *
* @param {ICredentials} creds The new credentials to use. * @param {IMatrixClientCreds} creds The new credentials to use.
*/ */
public replaceUsingCreds(creds: ICredentials): void { public replaceUsingCreds(creds: IMatrixClientCreds): void {
this.currentClientCreds = creds; this.currentClientCreds = creds;
this._createClient(creds); this._createClient(creds);
} }
@ -198,7 +198,7 @@ class _MatrixClientPeg {
console.log(`MatrixClientPeg: MatrixClient started`); console.log(`MatrixClientPeg: MatrixClient started`);
} }
public getCredentials(): ICredentials { public getCredentials(): IMatrixClientCreds {
return { return {
homeserverUrl: this.matrixClient.baseUrl, homeserverUrl: this.matrixClient.baseUrl,
identityServerUrl: this.matrixClient.idBaseUrl, identityServerUrl: this.matrixClient.idBaseUrl,
@ -224,7 +224,7 @@ class _MatrixClientPeg {
return matches[1]; return matches[1];
} }
private _createClient(creds: ICredentials): void { private _createClient(creds: IMatrixClientCreds): void {
// TODO: Make these opts typesafe with the js-sdk // TODO: Make these opts typesafe with the js-sdk
const opts = { const opts = {
baseUrl: creds.homeserverUrl, baseUrl: creds.homeserverUrl,

View File

@ -29,7 +29,7 @@ import { fixupColorFonts } from '../../utils/FontManager';
import * as sdk from '../../index'; import * as sdk from '../../index';
import dis from '../../dispatcher/dispatcher'; import dis from '../../dispatcher/dispatcher';
import sessionStore from '../../stores/SessionStore'; import sessionStore from '../../stores/SessionStore';
import {MatrixClientPeg, MatrixClientCreds} from '../../MatrixClientPeg'; import {MatrixClientPeg, IMatrixClientCreds} from '../../MatrixClientPeg';
import SettingsStore from "../../settings/SettingsStore"; import SettingsStore from "../../settings/SettingsStore";
import TagOrderActions from '../../actions/TagOrderActions'; import TagOrderActions from '../../actions/TagOrderActions';
@ -57,7 +57,7 @@ function canElementReceiveInput(el) {
interface IProps { interface IProps {
matrixClient: MatrixClient; matrixClient: MatrixClient;
onRegistered: (credentials: MatrixClientCreds) => Promise<MatrixClient>; onRegistered: (credentials: IMatrixClientCreds) => Promise<MatrixClient>;
viaServers?: string[]; viaServers?: string[];
hideToSRUsers: boolean; hideToSRUsers: boolean;
resizeNotifier: ResizeNotifier; resizeNotifier: ResizeNotifier;