Skip to content

Commit 22977ea

Browse files
authoredMar 23, 2023
Fix Create Call Signature (#5617)
This allows the create static function to be used without a type error. This reflects the change we made in bindgen.

File tree

6 files changed

+12216
-12314
lines changed

6 files changed

+12216
-12314
lines changed
 

‎CHANGELOG.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
* None
88

99
### Fixed
10-
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
11-
* None
10+
* Fix type error when using `realm.create` in combination with class base models. (since v11.0.0)
1211

1312
### Compatibility
1413
* React Native >= v0.71.0
@@ -41,7 +40,7 @@
4140

4241
### Internal
4342
* Upgraded Realm Core from v13.4.2 to v13.6.0. ([#5495](https://github.com/realm/realm-js/issues/5495))
44-
* All exceptions thrown out of Realm Core are now of type `Exception`.
43+
* All exceptions thrown out of Realm Core are now of type `Exception`.
4544

4645
## 11.5.1-alpha.0 (2023-02-21)
4746

‎example/app/components/TaskManager.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const TaskManager: React.FC<{
2828
// of sync participants to successfully sync everything in the transaction, otherwise
2929
// no changes propagate and the transaction needs to start over when connectivity allows.
3030
realm.write(() => {
31-
return new Task(realm, description, userId);
31+
realm.create(Task, {description, userId});
3232
});
3333
},
3434
[realm, userId],

‎example/app/models/Task.ts

-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,4 @@ export class Task extends Realm.Object<Task> {
1919
userId!: string;
2020

2121
static primaryKey = '_id';
22-
23-
constructor(realm: Realm, description: string, userId?: string) {
24-
super(realm, {description, userId: userId || '_SYNC_DISABLED_'});
25-
}
2622
}

0 commit comments

Comments
 (0)
Please sign in to comment.