Realm-js: Linting Rule: Warn about Spread Syntax with Realm.Object

Created on 7 Oct 2020  路  2Comments  路  Source: realm/realm-js

Feature Request

If the spread syntax is used with Realm.Objects, the result is a just empty object.

e.g.

const copied = { ...someRealmObject } // 'copied' will be empty, because spread syntax is not working

It should be possible to implement, with Typescript and Eslint, a rule that warns about spreading Realm.Objects.

So, it would be awesome, if there was an ESLint rule that gave an error if spreading an object that is extending Realm.Object. This ESLint rule would make realm-js more typesafe :)

This is, of course, is just a nice to have a feature 馃槃

O-Community Pipeline-Idea-Backlog

Most helpful comment

Even nicer would be to fix the implementation so that it works with the spread operator 馃槣

All 2 comments

Even nicer would be to fix the implementation so that it works with the spread operator 馃槣

@Frans-L Thanks for the suggestion.

Was this page helpful?
0 / 5 - 0 ratings