javascriptflowtype

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


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.


Solution

  • 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