1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Fix up some more type defs

This commit is contained in:
Michael Telatynski
2021-06-17 14:49:27 +01:00
parent 7c61b9cf7e
commit 608b0e7b93

View File

@@ -87,7 +87,7 @@ export interface IEvent {
txn_id?: string;
state_key?: string;
membership?: string;
unsigned?: IUnsigned;
unsigned: IUnsigned;
redacts?: string;
// v1 legacy fields
@@ -324,11 +324,11 @@ export class MatrixEvent extends EventEmitter {
*
* @return {Object} The event content JSON, or an empty object.
*/
public getOriginalContent(): IContent {
public getOriginalContent<T = IContent>(): T {
if (this._localRedactionEvent) {
return {};
return {} as T;
}
return this.clearEvent.content || this.event.content || {};
return (this.clearEvent.content || this.event.content || {}) as T;
}
/**
@@ -338,9 +338,9 @@ export class MatrixEvent extends EventEmitter {
*
* @return {Object} The event content JSON, or an empty object.
*/
public getContent(): IContent {
public getContent<T = IContent>(): T {
if (this._localRedactionEvent) {
return {};
return {} as T;
} else if (this._replacingEvent) {
return this._replacingEvent.getContent()["m.new_content"] || {};
} else {