Requires to make a type alias for all union and intersection types. If these are used in "raw" forms it might be tempting to just copy & paste them around the code. However, this brings sort of a source code pollution and unnecessary changes on several parts when these compound types need to be changed.
The rule has two options:
- a string option
"always"
(default)"never"
- an object
{
"rules": {
"flowtype/require-compound-type-alias": [
2,
"always",
{
"allowNull": true
}
]
}
}
allowNull
– allows compound types where one of the members is anull
, e.g.string | null
.