Improve quality of Typescript types (#10742)
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user