Skip to content

Commit 26c89d9

Browse files
committed
Fix return type on getAccessToken
The value can be undefined, but the type was just string tests: Ran all tests
1 parent 9f01c8d commit 26c89d9

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

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

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

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

0 commit comments

Comments
 (0)