Type of stream. What does the `+` sign in front of a property mean?

I stumbled upon the following code written in js FlowType (I'm interested in knowing the value of + in the context of FlowType not in general JS).

Could you explain to me what the symbol +before the property means in the code below:

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

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

+6
source share
3 answers

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

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

+8
source

, +/- .

interface MyInterface {
  +covariant: number;     // read-only
  -contravariant: number; // write-only
}

Interesting article about the difference:

https://flow.org/en/docs/lang/variance/

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

+1
source

All Articles