realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.62k stars 558 forks source link

Typescript: OmittedRealmTypes type removed in 12.3? #6288

Open doelgonzo opened 5 months ago

doelgonzo commented 5 months ago

How frequently does the bug occur?

Always

Description

Was OmittedRealmTypes removed from exports now? I receive the following (After upgrade from 12.2.1 to 12.3.1):

Module '"realm"' has no exported member 'OmittedRealmTypes'

Note, I'm simply trying to type the data being returned without all the other props returned with Realm.Object OmittedRealmTypes<T> used to achieve this but now it's no longer exported?

Stacktrace & log output

No response

Can you reproduce the bug?

Reproduction Steps

No response

Version

12.3

What services are you using?

Atlas Device Sync

Are you using encryption?

No

Platform OS and version(s)

MacOS

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

doelgonzo commented 5 months ago

Note, a workaround would be to include our own type like

type OmittedRealmTypes<T> = Omit<
  T,
  | '_objectId'
  | '_objectKey'
  | 'addListener'
  | 'entries'
  | 'getPropertyType'
  | 'isValid'
  | 'keys'
  | 'linkingObjects'
  | 'linkingObjectsCount'
  | 'objectSchema'
  | 'removeAllListeners'
  | 'removeListener'
  | 'toJSON'
>

But it could break on updates that change the Realm.Object structure. Is there a different way I should be doing this? Note, I am using this where I have data that matches the schema in Realm before writing the data, and it would be ideal to not repeat the type outside of the class defining the schema. Maybe I'm going about this wrong?

kneth commented 5 months ago

@doelgonzo

Thank you for reporting. We need to investigate in order to find a solution.