Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 817
GibboK Avatar asked Sep 21 '17 08:09

GibboK


People also ask

What is flow typed?

In programming language theory, flow-sensitive typing (also called flow typing or occurrence typing) is a type system where the type of an expression depends on its position in the control flow. In statically typed languages, a type of an expression is determined by the types of the sub-expressions that compose it.

What is an interface Flow?

User Interface Flows are system models the show how different pages of a user interface are connected and how a user can step through various pages of the system. User Interface Flows are typically comprised of screens and navigation paths between various screens.

What is string flow?

String Flow Viola samples a technique string players use, in which they quickly roll the bow across the strings to create an energetic, chordal texture. There are 2 ways to play the instrument. The first way is simple: just choose what type of chord you want, what key to be in, and then play on the white keys.

What is flow and TypeScript?

Both Flow and TypeScript provide the ability to explicitly cast a variable from one type to another. With Flow, we cast using the symbol : , while in TypeScript we cast using the keyword as . // TypeScript let value = 1 as number; // Flow let value = 1; (value: number);


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 139
MichaelDeBoey Avatar answered Sep 19 '22 03:09

MichaelDeBoey