diff --git a/packages/realm/src/JSONCacheMap.ts b/packages/realm/src/JSONCacheMap.ts index 6893461601..47f9e95254 100644 --- a/packages/realm/src/JSONCacheMap.ts +++ b/packages/realm/src/JSONCacheMap.ts @@ -19,8 +19,8 @@ import { DefaultObject, INTERNAL, RealmObject } from "./internal"; /** @internal */ -export class JSONCacheMap extends Map> { - add(object: RealmObject, value: DefaultObject) { +export class JSONCacheMap extends Map> { + add(object: RealmObject, value: T) { const tableKey = object[INTERNAL].table.key; let cachedMap = this.get(tableKey); if (!cachedMap) { @@ -29,7 +29,7 @@ export class JSONCacheMap extends Map> { } cachedMap.set(object._objectKey(), value); } - find(object: RealmObject) { + find(object: RealmObject) { return this.get(object[INTERNAL].table.key)?.get(object._objectKey()); } } diff --git a/packages/realm/src/Object.ts b/packages/realm/src/Object.ts index 4e96620f0e..248dce49b1 100644 --- a/packages/realm/src/Object.ts +++ b/packages/realm/src/Object.ts @@ -382,9 +382,9 @@ export class RealmObject; /** @internal */ - toJSON(_?: string, cache = new JSONCacheMap()): DefaultObject { + toJSON(_?: string, cache = new JSONCacheMap()): OmittedRealmTypes { // Construct a reference-id of table-name & primaryKey if it exists, or fall back to objectId. // Check if current objectId has already processed, to keep object references the same. @@ -392,7 +392,7 @@ export class RealmObject