Skip to content

Commit dfbea62

Browse files
texufYoric
authored andcommitted
Fix return type on funcs in matrixClient to be optionally null (matrix-org#2488)
1 parent 7546df8 commit dfbea62

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/client.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
14031403
*
14041404
* @return {?string} MXID for the logged-in user, or null if not logged in
14051405
*/
1406-
public getUserId(): string {
1406+
public getUserId(): string | null {
14071407
if (this.credentials && this.credentials.userId) {
14081408
return this.credentials.userId;
14091409
}
@@ -1425,7 +1425,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
14251425
* Get the local part of the current user ID e.g. "foo" in "@foo:bar".
14261426
* @return {?string} The user ID localpart or null.
14271427
*/
1428-
public getUserIdLocalpart(): string {
1428+
public getUserIdLocalpart(): string | null {
14291429
if (this.credentials && this.credentials.userId) {
14301430
return this.credentials.userId.split(":")[0].substring(1);
14311431
}
@@ -1480,7 +1480,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
14801480
* @param {string} roomId The room the call is to be placed in.
14811481
* @return {MatrixCall} the call or null if the browser doesn't support calling.
14821482
*/
1483-
public createCall(roomId: string): MatrixCall {
1483+
public createCall(roomId: string): MatrixCall | null {
14841484
return createNewMatrixCall(this, roomId);
14851485
}
14861486

@@ -1788,7 +1788,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
17881788
*
17891789
* @return {module:crypto/deviceinfo} device or null
17901790
*/
1791-
public getStoredDevice(userId: string, deviceId: string): DeviceInfo {
1791+
public getStoredDevice(userId: string, deviceId: string): DeviceInfo | null {
17921792
if (!this.crypto) {
17931793
throw new Error("End-to-end encryption disabled");
17941794
}
@@ -3313,7 +3313,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
33133313
* @return {?User} A user or null if there is no data store or the user does
33143314
* not exist.
33153315
*/
3316-
public getUser(userId: string): User {
3316+
public getUser(userId: string): User | null {
33173317
return this.store.getUser(userId);
33183318
}
33193319

@@ -6823,7 +6823,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
68236823
* Get the access token associated with this account.
68246824
* @return {?String} The access_token or null
68256825
*/
6826-
public getAccessToken(): string {
6826+
public getAccessToken(): string | null {
68276827
return this.http.opts.accessToken || null;
68286828
}
68296829

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

0 commit comments

Comments
 (0)