Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
weeman1337 committed Mar 6, 2023
1 parent 1b72bf6 commit d681c47
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/utils/permalinks/PermalinkConstructor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export default class PermalinkConstructor {
// https://github.com/turt2live/matrix-js-bot-sdk/blob/7c4665c9a25c2c8e0fe4e509f2616505b5b66a1c/src/Permalinks.ts#L1-L6
export class PermalinkParts {
public constructor(
public readonly roomIdOrAlias: string,
public readonly eventId: string,
public readonly userId: string,
public readonly viaServers: string[],
public readonly roomIdOrAlias: string | null,
public readonly eventId: string | null,
public readonly userId: string | null,
public readonly viaServers: string[] | null,
) {}

public static forUser(userId: string): PermalinkParts {
Expand All @@ -66,11 +66,11 @@ export class PermalinkParts {
return new PermalinkParts(roomId, eventId, null, viaServers);
}

public get primaryEntityId(): string {
public get primaryEntityId(): string | null {
return this.roomIdOrAlias || this.userId;
}

public get sigil(): string {
return this.primaryEntityId[0];
return this.primaryEntityId?.[0] || "?";
}
}

0 comments on commit d681c47

Please sign in to comment.