1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-06 12:02:40 +03:00

Update some more

This commit is contained in:
Michael Telatynski
2021-07-12 09:10:27 +01:00
parent b33429317c
commit c0e16ac98c
4 changed files with 11 additions and 12 deletions

View File

@@ -15,9 +15,9 @@ limitations under the License.
*/
import { MatrixClient } from "./client";
import { MatrixEvent } from "./models/event";
import { IEvent, MatrixEvent } from "./models/event";
export type EventMapper = (obj: any) => MatrixEvent;
export type EventMapper = (obj: Partial<IEvent>) => MatrixEvent;
export interface MapperOpts {
preventReEmit?: boolean;
@@ -28,7 +28,7 @@ export function eventMapperFor(client: MatrixClient, options: MapperOpts): Event
const preventReEmit = Boolean(options.preventReEmit);
const decrypt = options.decrypt !== false;
function mapper(plainOldJsObject) {
function mapper(plainOldJsObject: Partial<IEvent>) {
const event = new MatrixEvent(plainOldJsObject);
if (event.isEncrypted()) {
if (!preventReEmit) {