Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is this '+' prefix on a Flow type definition? [duplicate]

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.

like image 841
GibboK Avatar asked Nov 18 '22 11:11

GibboK


1 Answers

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

like image 106
MichaelDeBoey Avatar answered Jan 02 '23 05:01

MichaelDeBoey