Defining stream types and creating immutable records

I am trying to get Flow to work with Immutable.js records.

Im defines my entry as:

const MyRecord = new Immutable.Record({id: undefined})

and then create entries using

new MyRecord({id: 1})

When I run Flow, I get an error when calling a constructor new MyRecordthat says:

Call constructor A constructor cannot be called in a record

Am I defining a record incorrectly? Or do I need to somehow specify the type of constructor?

I am using flow-bin 0.33.0 and immutable 3.8.0 inside a React Native 0.38.0 project.

Thank!

+4
source share
1 answer

, . Record , . new .

+2

Source: https://habr.com/ru/post/1664365/


All Articles