What is this format in javascript or typescript? I couldn't find any info.
export type XXX<> = | true (= |
)
$ReadOnly
(meanings)
<{|
... |
}>
export type AttributeType<T, V> =
| true
| $ReadOnly<{|
diff?: (arg1: T, arg2: T) => boolean,
process?: (arg1: V) => T,
|}>;
diff
will be identified as boolean | undefined
; and process
will be identified as type | undefined
; Since all values has a default value of undefined, the compiler won't complain that process
or diff
is not assigned.I found it... Facebook use 'flow'. (no typescript) https://flow.org/en/