-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Realm Babel
-
2 - S (<= 1 week)
-
5226
How frequently does the bug occur?
All the time
Description
I want to declare my realm object class properties as constant-named properties so I can reuse the constants in queries.
(https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#constant-named-properties)
There was an Unexpected token error on the property with @index.
EDIT: the Babel plugin also does NOT add properties to the schema for constant-named properties.
e.g.
const PropertyNames = { MyIdGuid: 'myIdGuid', LastModifiedTimestamp: 'lastModifiedTimestamp' } as const; export class MyRealmObject extends Realm.Object<MyRealmObject> { // This works EDIT: BUT the property does NOT get added to the generated schema [PropertyNames.MyIdGuid]!: Realm.BSON.UUID; // **** This does NOT work - TransformError SyntaxError: 'Unexpected token' error - at the location of the colon **** @index [PropertyNames.LastModifiedTimestamp]!: Date; // This does work @index lastModifiedTimestamp!: Date; ...
Stacktrace & log output
Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
There is a `TransformError SyntaxError:` `Unexpected token` error - at the location of the colon @index [PropertyNames.LastModifiedTimestamp]!: Date;
```
Can you reproduce the bug?
Yes, always
Reproduction Steps
See code in Description
Version
Babel plugin 0.1.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: ..
Cocoapods version
No response