Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-1993

Babel plugin does not cover all type-infer situations

      How frequently does the bug occur?

      All the time

      Description

      Demo code when working with @realm/babel-plugin@0.1.0 and realm@11.1.0 :

      import Realm from "realm";
      
      export class NoteSchema extends Realm.Object<NoteSchema, "content"> {
        // @ts-ignore
        static name = "MyNote"
        _id = new Realm.BSON.ObjectId()
        createdAt = Date.now()
        content!: string
      }
      

      After babel transformation, createdAt was missed in schema:

      NoteSchema.schema = {
          name: "NoteSchema",
          properties: {
            _id: {
              type: "objectId",
              default: function _default() {
                return new _realm.default.BSON.ObjectId();
              }
            },
            content: {
              type: "string"
            }
          },
          name: "MyNote"
        };
      

      Stacktrace & log output

      No response

      Can you reproduce the bug?

      Yes, always

      Reproduction Steps

      No response

      Version

      @realm/babel-plugin@0.1.0 and realm@11.1.0

      What SDK flavour are you using?

      Local Database only

      Are you using encryption?

      No, not using encryption

      Platform OS and version(s)

      it's just a js side issue

      Build environment

      No response

      Cocoapods version

      No response

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: