Flow type, What does the `+` symbol mean in front a property?

GibboK picture GibboK · Sep 21, 2017 · Viewed 7.2k times · Source

I came across the following code written in js FlowType (I am interested to know the value of + in the context of FlowType not in general JS).

Could you please explain me what does the + symbol mean in front of the property in the code below:

  export type User = {
      +name: string,
      +surname: string,
      +personId: PourceId,
    }

I could not find any reference in the documentation, any link is also welcome.

Answer

MichaelDeBoey picture MichaelDeBoey · Sep 21, 2017

The + symbol in front of the property means the property is read-only

Reference: https://flow.org/en/docs/types/interfaces/#toc-interface-property-variance-read-only-and-write-only