Skip to content

Commit

Permalink
Fixing TS issue after class-based models
Browse files Browse the repository at this point in the history
Adding an entry in the changelog
  • Loading branch information
kraenhansen committed Jun 8, 2022
1 parent 323d214 commit bb088a4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ realm.write(() => {

### Fixed
* Fixed build error (call to implicitly-deleted copy constructor of 'realm::js::RealmClass<realm::js::realmjsi::Types>::Arguments') (follow up to [#4568](https://github.com/realm/realm-js/pull/4568))
* Fixed a few TS errors in the `@realm/react` package, introduced by ([#4537](https://github.com/realm/realm-js/pull/4537)).

### Compatibility
* Atlas App Services.
* Realm Studio v11.0.0.
* APIs are backwards compatible with all previous releases of Realm JavaScript in the 10.5.x series.
* File format: generates Realms with format v22 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms).

### Internal
* Remove the previous implementation to the JavaScriptCore engine (in `src/jsc`).
* Upgrade Example to RN v0.68.2
Expand Down
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 bb088a4

Please sign in to comment.