Which `circle: (null :? {setNativeProps (props: object): void})` means

I am studying react native. I am trying to understand the code here . The below snippet seems very strange to me. Could you explain what he is doing?

circle: (null : ?{ setNativeProps(props: Object): void })

I know the instructions if, for example:

blabla = (if-this-is-true) ? this-should-be-used : otherwise_this

but I don’t know if the circle is the same.

+4
source share
2 answers

This is a stream type annotation. Stream is a static type checking tool for JavaScript ( https://flow.org/ ).

?Type , , undefined, null "". , string, null undefined. .

(null: Type) - cast (). cast, , .

(null : ?{ setNativeProps(props: Object): void }) null Maybe, :

  • setNativeProps, (void type),
  • null,
  • undefined
+2

(x: y) , . x y.

null

?{ setNativeProps(props: Object): void }

, setNativeProps. (void).

https://flow.org/.

+2

Source: https://habr.com/ru/post/1687076/


All Articles