Skip to content

Commit

Permalink
Avoid BigInt literals as JSC/Android doesn't support it (#6289)
Browse files Browse the repository at this point in the history
  • Loading branch information
kneth authored Nov 29, 2023
1 parent 0e6a215 commit 21da553
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Fixed
* When mapTo is used on a property of type List, an error like `Property 'test_list' does not exist on 'Task' objects` occurs when trying to access the property. ([#6268](https://github.com/realm/realm-js/issues/6268), since v12.0.0)
* Fixed bug where apps running under JavaScriptCore on Android will terminate with the error message `No identifiers allowed directly after numeric literal`. ([#6194](https://github.com/realm/realm-js/issues/6194), since v12.2.0)

### Compatibility
* React Native >= v0.71.4
Expand Down
4 changes: 2 additions & 2 deletions packages/realm/src/Realm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,15 @@ export class Realm {
* @since 0.11.0
*/
public static schemaVersion(path: string, encryptionKey?: ArrayBuffer | ArrayBufferView): number {
const notFound = 18446744073709551615n; // std::numeric_limit<uint64_t>::max() = 0xffffffffffffffff
const notFound = "18446744073709551615"; // std::numeric_limit<uint64_t>::max() = 0xffffffffffffffff as string
const config: Configuration = { path };
const absolutePath = Realm.determinePath(config);
const schemaVersion = binding.Realm.getSchemaVersion({
path: absolutePath,
encryptionKey: Realm.determineEncryptionKey(encryptionKey),
});
// no easy way to compare uint64_t in TypeScript
return notFound.toString() === schemaVersion.toString() ? -1 : binding.Int64.intToNum(schemaVersion);
return notFound === schemaVersion.toString() ? -1 : binding.Int64.intToNum(schemaVersion);
}

/**
Expand Down

0 comments on commit 21da553

Please sign in to comment.