Resolve typing errors after TypeScript upgrade
This commit is contained in:
parent
ea706189a2
commit
84b1f2e6c6
11 changed files with 14 additions and 16 deletions
|
@ -56,7 +56,7 @@ export default abstract class BasePlatform {
|
|||
this.startUpdateCheck = this.startUpdateCheck.bind(this);
|
||||
}
|
||||
|
||||
abstract async getConfig(): Promise<{}>;
|
||||
abstract getConfig(): Promise<{}>;
|
||||
|
||||
abstract getDefaultDeviceDisplayName(): string;
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ export default class ContentMessages {
|
|||
content.info.mimetype = file.type;
|
||||
}
|
||||
|
||||
const prom = new Promise((resolve) => {
|
||||
const prom = new Promise<void>((resolve) => {
|
||||
if (file.type.indexOf('image/') === 0) {
|
||||
content.msgtype = 'm.image';
|
||||
infoForImageFile(matrixClient, roomId, file).then((imageInfo) => {
|
||||
|
|
|
@ -840,7 +840,7 @@ export default class CountlyAnalytics {
|
|||
let endTime = CountlyAnalytics.getTimestamp();
|
||||
const cli = MatrixClientPeg.get();
|
||||
if (!cli.getRoom(roomId)) {
|
||||
await new Promise(resolve => {
|
||||
await new Promise<void>(resolve => {
|
||||
const handler = (room) => {
|
||||
if (room.roomId === roomId) {
|
||||
cli.off("Room", handler);
|
||||
|
@ -880,7 +880,7 @@ export default class CountlyAnalytics {
|
|||
let endTime = CountlyAnalytics.getTimestamp();
|
||||
|
||||
if (!room.findEventById(eventId)) {
|
||||
await new Promise(resolve => {
|
||||
await new Promise<void>(resolve => {
|
||||
const handler = (ev) => {
|
||||
if (ev.getId() === eventId) {
|
||||
room.off("Room.localEchoUpdated", handler);
|
||||
|
|
|
@ -422,6 +422,8 @@ export function bodyToHtml(content: IContent, highlights: string[], opts: IOpts
|
|||
if (SettingsStore.getValue("feature_latex_maths")) {
|
||||
const phtml = cheerio.load(safeBody,
|
||||
{ _useHtmlParser2: true, decodeEntities: false })
|
||||
// @ts-ignore - The types for `replaceWith` wrongly expect
|
||||
// Cheerio instance to be returned.
|
||||
phtml('div, span[data-mx-maths!=""]').replaceWith(function(i, e) {
|
||||
return katex.renderToString(
|
||||
AllHtmlEntities.decode(phtml(e).attr('data-mx-maths')),
|
||||
|
|
|
@ -196,7 +196,7 @@ export default class PasswordLogin extends React.PureComponent<IProps, IState> {
|
|||
|
||||
// Validation and state updates are async, so we need to wait for them to complete
|
||||
// first. Queue a `setState` callback and wait for it to resolve.
|
||||
await new Promise(resolve => this.setState({}, resolve));
|
||||
await new Promise<void>(resolve => this.setState({}, resolve));
|
||||
|
||||
if (this.allFieldsValid()) {
|
||||
return true;
|
||||
|
|
|
@ -194,7 +194,7 @@ export default class RegistrationForm extends React.PureComponent<IProps, IState
|
|||
|
||||
// Validation and state updates are async, so we need to wait for them to complete
|
||||
// first. Queue a `setState` callback and wait for it to resolve.
|
||||
await new Promise(resolve => this.setState({}, resolve));
|
||||
await new Promise<void>(resolve => this.setState({}, resolve));
|
||||
|
||||
if (this.allFieldsValid()) {
|
||||
return true;
|
||||
|
|
|
@ -519,7 +519,7 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
|
|||
|
||||
private async tabCompleteName(event: React.KeyboardEvent) {
|
||||
try {
|
||||
await new Promise(resolve => this.setState({showVisualBell: false}, resolve));
|
||||
await new Promise<void>(resolve => this.setState({showVisualBell: false}, resolve));
|
||||
const {model} = this.props;
|
||||
const caret = this.getCaret();
|
||||
const position = model.positionForOffset(caret.offset, caret.atNodeEnd);
|
||||
|
|
|
@ -235,7 +235,7 @@ export async function downloadBugReport(opts: IOpts = {}) {
|
|||
let i = 0;
|
||||
for (const [key, value] of body.entries()) {
|
||||
if (key === 'compressed-log') {
|
||||
await new Promise((resolve => {
|
||||
await new Promise<void>((resolve => {
|
||||
const reader = new FileReader();
|
||||
reader.addEventListener('loadend', ev => {
|
||||
tape.append(`log-${i++}.log`, new TextDecoder().decode(ev.target.result as ArrayBuffer));
|
||||
|
@ -269,7 +269,7 @@ function uint8ToString(buf: Buffer) {
|
|||
}
|
||||
|
||||
function _submitReport(endpoint: string, body: FormData, progressCallback: (string) => void) {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const req = new XMLHttpRequest();
|
||||
req.open("POST", endpoint);
|
||||
req.timeout = 5 * 60 * 1000;
|
||||
|
|
|
@ -43,7 +43,7 @@ export abstract class AsyncStoreWithClient<T extends Object> extends AsyncStore<
|
|||
})(dispatcher);
|
||||
}
|
||||
|
||||
protected get matrixClient(): MatrixClient {
|
||||
get matrixClient(): MatrixClient {
|
||||
return this.readyStore.mxClient;
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ export abstract class AsyncStoreWithClient<T extends Object> extends AsyncStore<
|
|||
// Default implementation is to do nothing.
|
||||
}
|
||||
|
||||
protected abstract async onAction(payload: ActionPayload);
|
||||
protected abstract onAction(payload: ActionPayload): Promise<void>;
|
||||
|
||||
protected async onDispatch(payload: ActionPayload) {
|
||||
await this.onAction(payload);
|
||||
|
|
|
@ -89,10 +89,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
|
|||
return this.algorithm.getOrderedRooms();
|
||||
}
|
||||
|
||||
public get matrixClient(): MatrixClient {
|
||||
return super.matrixClient;
|
||||
}
|
||||
|
||||
// Intended for test usage
|
||||
public async resetStore() {
|
||||
await this.reset();
|
||||
|
|
|
@ -6542,7 +6542,7 @@ qrcode@^1.4.4:
|
|||
pngjs "^3.3.0"
|
||||
yargs "^13.2.4"
|
||||
|
||||
qs@^6.9.4, qs@^6.9.6:
|
||||
qs@^6.9.6:
|
||||
version "6.9.6"
|
||||
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.6.tgz#26ed3c8243a431b2924aca84cc90471f35d5a0ee"
|
||||
integrity sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==
|
||||
|
|
Loading…
Reference in a new issue