1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Fix more type definitions

This commit is contained in:
Michael Telatynski
2021-06-17 14:24:53 +01:00
parent 50a973409a
commit 7c61b9cf7e
4 changed files with 7 additions and 6 deletions

View File

@@ -2730,7 +2730,7 @@ export class MatrixClient extends EventEmitter {
* @return {Promise} Resolves: TODO * @return {Promise} Resolves: TODO
* @return {module:http-api.MatrixError} Rejects: with an error response. * @return {module:http-api.MatrixError} Rejects: with an error response.
*/ */
public setAccountData(eventType: string, content: any, callback?: Callback): Promise<void> { public setAccountData(eventType: EventType | string, content: any, callback?: Callback): Promise<void> {
const path = utils.encodeUri("/user/$userId/account_data/$type", { const path = utils.encodeUri("/user/$userId/account_data/$type", {
$userId: this.credentials.userId, $userId: this.credentials.userId,
$type: eventType, $type: eventType,
@@ -2749,7 +2749,7 @@ export class MatrixClient extends EventEmitter {
* @param {string} eventType The event type * @param {string} eventType The event type
* @return {?object} The contents of the given account data event * @return {?object} The contents of the given account data event
*/ */
public getAccountData(eventType: string): any { public getAccountData(eventType: string): MatrixEvent {
return this.store.getAccountData(eventType); return this.store.getAccountData(eventType);
} }

View File

@@ -77,7 +77,7 @@ interface IUnsigned {
redacted_because?: IEvent; redacted_because?: IEvent;
} }
interface IEvent { export interface IEvent {
event_id: string; event_id: string;
type: string; type: string;
content: IContent; content: IContent;

View File

@@ -42,6 +42,7 @@ export class User extends EventEmitter {
presence: null, presence: null,
profile: null, profile: null,
}; };
// eslint-disable-next-line camelcase
public unstable_statusMessage = ""; public unstable_statusMessage = "";
/** /**
@@ -208,7 +209,7 @@ export class User extends EventEmitter {
* @fires module:client~MatrixClient#event:"User.unstable_statusMessage" * @fires module:client~MatrixClient#event:"User.unstable_statusMessage"
*/ */
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
public _unstable_updateStatusMessage(event: MatrixEvent): void { public unstable_updateStatusMessage(event: MatrixEvent): void {
if (!event.getContent()) this.unstable_statusMessage = ""; if (!event.getContent()) this.unstable_statusMessage = "";
else this.unstable_statusMessage = event.getContent()["status"]; else this.unstable_statusMessage = event.getContent()["status"];
this.updateModifiedTime(); this.updateModifiedTime();

View File

@@ -1272,10 +1272,10 @@ SyncApi.prototype._processSyncResponse = async function(
if (e.isState() && e.getType() === "im.vector.user_status") { if (e.isState() && e.getType() === "im.vector.user_status") {
let user = client.store.getUser(e.getStateKey()); let user = client.store.getUser(e.getStateKey());
if (user) { if (user) {
user._unstable_updateStatusMessage(e); user.unstable_updateStatusMessage(e);
} else { } else {
user = createNewUser(client, e.getStateKey()); user = createNewUser(client, e.getStateKey());
user._unstable_updateStatusMessage(e); user.unstable_updateStatusMessage(e);
client.store.storeUser(user); client.store.storeUser(user);
} }
} }