16 Document types conventions
Wei Zhu edited this page 2017-01-20 20:09:07 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Follows TypeScript's type style.

Lowercase type names

  • boolean for boolean values;
  • string for string values;
  • string[] or Array<string> for array values;
  • number for number values;
  • any for any value;
  • object for plain objects;

Function

(selectedRowKeys: string[], selectedRows: <T>[]) => any

Array

string[]

// element has multiple types
Array<string|number>

Enum

'primary'|'ghost'|'dashed'

Using | for multiple types

Markdown requires \ to escape | in table.

boolean\|number

If a prop accepts any kind of React node

string|ReactNode

If a prop only accepts string or a single React element:

string|ReactElement

If a prop only accepts specific element

Menu.Item

// for array
Menu.Item[]

If a prop only accepts specific element with specific props:

ReactElement<InputProps>
  1. Get type's permanent link: 1bf0bab2a7/components/cascader/index.tsx (L9)
  2. Use https://git.io shorten url
[CascaderOptionType](https://git.io/vMMoK)[]