Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 841 Bytes

require-compound-type-alias.md

File metadata and controls

32 lines (23 loc) · 841 Bytes

require-compound-type-alias

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.

Options

The rule has two options:

  1. a string option
  • "always" (default)
  • "never"
  1. an object
{
  "rules": {
    "flowtype/require-compound-type-alias": [
      2,
      "always",
      {
        "allowNull": true
      }
    ]
  }
}
  • allowNull – allows compound types where one of the members is a null, e.g. string | null.