Improve quality of Typescript types (#10742)

This commit is contained in:
Michael Telatynski
2023-05-05 09:11:14 +01:00
committed by GitHub
parent 542bf68c63
commit a4f0b80692
30 changed files with 74 additions and 75 deletions
+2 -2
View File
@@ -36,8 +36,8 @@ export interface IAutocompleteOptions {
}
export default abstract class AutocompleteProvider {
public commandRegex: RegExp;
public forcedCommandRegex: RegExp;
public commandRegex?: RegExp;
public forcedCommandRegex?: RegExp;
protected renderingType: TimelineRenderingType = TimelineRenderingType.Room;
+1 -1
View File
@@ -47,7 +47,7 @@ interface IOptions<T extends {}> {
*/
export default class QueryMatcher<T extends {}> {
private _options: IOptions<T>;
private _items: Map<string, { object: T; keyWeight: number }[]>;
private _items = new Map<string, { object: T; keyWeight: number }[]>();
public constructor(objects: T[], options: IOptions<T> = { keys: [] }) {
this._options = options;
+2 -2
View File
@@ -44,7 +44,7 @@ const FORCED_USER_REGEX = /[^/,:; \t\n]\S*/g;
export default class UserProvider extends AutocompleteProvider {
public matcher: QueryMatcher<RoomMember>;
public users: RoomMember[] | null;
public users?: RoomMember[];
public room: Room;
public constructor(room: Room, renderingType?: TimelineRenderingType) {
@@ -98,7 +98,7 @@ export default class UserProvider extends AutocompleteProvider {
if (state.roomId !== this.room.roomId) return;
// blow away the users cache
this.users = null;
this.users = undefined;
};
public async getCompletions(