diff --git a/CHANGELOG.md b/CHANGELOG.md index 597708c6db..7494b514f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ x.x.x Release notes (yyyy-MM-dd) ### Internal * Adding use of [ccache](https://ccache.dev/) in build scripts, XCode projects and the integration tests GHA workflow. * Dropped using `install-local` in the integration tests, in favour of a more involved Metro configuration. +* Add combined type definition for Realm.object and Realm.objectForPrimaryKey so they can be cleanly wrapped. * * * diff --git a/types/index.d.ts b/types/index.d.ts index 974f33b457..eb5ef6d6d6 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -748,6 +748,9 @@ declare class Realm { * @returns {T | undefined} */ objectForPrimaryKey(type: {new(...arg: any[]): T; }, key: Realm.PrimaryKey): T | undefined; + + // Combined definitions + objectForPrimaryKey(type: string | {new(...arg: any[]): T; }, key: Realm.PrimaryKey): (T & Realm.Object) | undefined; /** * @param {string} type @@ -761,6 +764,9 @@ declare class Realm { */ objects(type: {new(...arg: any[]): T; }): Realm.Results; + // Combined definitions + objects(type: string | {new(...arg: any[]): T; }): Realm.Results; + /** * @param {string} name * @param {()=>void} callback