-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Realm Babel
-
1 - XS (<= 1 day)
-
5202
How frequently does the bug occur?
All the time
Description
The Babel plugin does not add a static schema to my TypeScript file when I don't explicitly import Realm in the ts file. The plugin's import checking apparently only succeeds when and requires that I have Realm directly imported in my .ts file - otherwise it doesn't process the class.
NOTE: I don't get an error in TypeScript when I don't have the import... it seems to globally know about Realm's namespace from /node_modules/realm/types/index.d.ts.
If it passes static analysis in TypeScript, I expect that the schema would be added by the Babel plugin.
This does NOT get a schema added by the Babel plugin (and also does not have a TypeScript error):
export class MyObject extends Realm.Object<MyObject> ...
This DOES get a schema added by the Babel plugin - because it explicitly imports Realm:
import { Realm } from '@realm/react'; export class MyObject extends Realm.Object<MyObject> ...
Stacktrace & log output
No response
Can you reproduce the bug?
Yes, always
Reproduction Steps
Remove the import statement from a Realm object.
Version
11.3.1
What SDK flavour are you using?
Local Database only
Are you using encryption?
No, not using encryption
Platform OS and version(s)
Android 11 R API 30 - Pixel 5 emulator
Build environment
Which debugger for React Native: Flpper
Cocoapods version
No response