Skip to content

Commit

Permalink
Fixing TS issue after class-based models
Browse files Browse the repository at this point in the history
  • Loading branch information
kraenhansen committed Jun 8, 2022
1 parent 9cd5dbd commit 2fe03d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/realm-react/src/cachedObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type CachedObjectArgs<T> = {
* @param args - {@link CachedObjectArgs} object arguments
* @returns Proxy object wrapping the {@link Realm.Object}
*/
export function createCachedObject<T extends Realm.Object>({
export function createCachedObject<T extends Realm.Object<T>>({
object,
realm,
updateCallback,
Expand Down Expand Up @@ -99,7 +99,7 @@ export function createCachedObject<T extends Realm.Object>({
// Don't force a second re-render if any of the changed properties is a Realm.List,
// as the List's cachedCollection will force a re-render itself
const anyListPropertyModified = changes.changedProperties.some((property) => {
return obj[property as keyof T] instanceof Realm.List;
return obj[property as keyof Realm.Object<T>] instanceof Realm.List;
});
const shouldRerender = !anyListPropertyModified;

Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ declare namespace Realm {
changedProperties: (keyof T)[]
}

type ObjectChangeCallback<T> = (object: T, changes: ObjectChangeSet<T>) => void;
type ObjectChangeCallback<T> = (object: Object<T>, changes: ObjectChangeSet<T>) => void;

/**
* Object
Expand Down

0 comments on commit 2fe03d3

Please sign in to comment.