Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
*
* @return {?string} MXID for the logged-in user, or null if not logged in
*/
public getUserId(): string {
public getUserId(): string | null {
if (this.credentials && this.credentials.userId) {
return this.credentials.userId;
}
Expand All @@ -1425,7 +1425,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* Get the local part of the current user ID e.g. "foo" in "@foo:bar".
* @return {?string} The user ID localpart or null.
*/
public getUserIdLocalpart(): string {
public getUserIdLocalpart(): string | null {
if (this.credentials && this.credentials.userId) {
return this.credentials.userId.split(":")[0].substring(1);
}
Expand Down Expand Up @@ -1480,7 +1480,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* @param {string} roomId The room the call is to be placed in.
* @return {MatrixCall} the call or null if the browser doesn't support calling.
*/
public createCall(roomId: string): MatrixCall {
public createCall(roomId: string): MatrixCall | null {
return createNewMatrixCall(this, roomId);
}

Expand Down Expand Up @@ -1788,7 +1788,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
*
* @return {module:crypto/deviceinfo} device or null
*/
public getStoredDevice(userId: string, deviceId: string): DeviceInfo {
public getStoredDevice(userId: string, deviceId: string): DeviceInfo | null {
if (!this.crypto) {
throw new Error("End-to-end encryption disabled");
}
Expand Down Expand Up @@ -3313,7 +3313,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* @return {?User} A user or null if there is no data store or the user does
* not exist.
*/
public getUser(userId: string): User {
public getUser(userId: string): User | null {
return this.store.getUser(userId);
}

Expand Down Expand Up @@ -6806,7 +6806,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* Get the access token associated with this account.
* @return {?String} The access_token or null
*/
public getAccessToken(): string {
public getAccessToken(): string | null {
return this.http.opts.accessToken || null;
}

Expand Down Expand Up @@ -8898,7 +8898,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
* @param {string} roomId The room ID to get a tree space reference for.
* @returns {MSC3089TreeSpace} The tree space, or null if not a tree space.
*/
public unstableGetFileTreeSpace(roomId: string): MSC3089TreeSpace {
public unstableGetFileTreeSpace(roomId: string): MSC3089TreeSpace | null {
const room = this.getRoom(roomId);
if (room?.getMyMembership() !== 'join') return null;

Expand Down