diff --git a/build/gulp/plugins/util/parseType.ts b/build/gulp/plugins/util/parseType.ts index 874a22ffc4..3bd85369dc 100644 --- a/build/gulp/plugins/util/parseType.ts +++ b/build/gulp/plugins/util/parseType.ts @@ -7,13 +7,13 @@ import { ComponentPropType } from 'docs/src/types' import { PropItem } from './docgen' import parseTypeAnnotation from './parseTypeAnnotation' -/** Performs transform: `ShorthandValue` to `ShorthandCollection[]`. */ +/** Performs transform: `ShorthandValue` to `ShorthandCollection[]`. */ const normalizeShorthandCollection = (propType: string): string => { - const regex = /ShorthandValue<(.+) & { kind\?: .+; }>\[]$/ + const regex = /ShorthandValue<(.+) & { kind\?: (.+); }>\[]$/ const result = regex.exec(propType) if (result) { - return `ShorthandCollection<${result[1]}>` + return `ShorthandCollection<${result[1]}, ${result[2]}>` } return propType diff --git a/docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsRow.tsx b/docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsRow.tsx index 853b09eedf..1556e4a140 100644 --- a/docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsRow.tsx +++ b/docs/src/components/ComponentDoc/ComponentPropsTable/ComponentPropsRow.tsx @@ -15,12 +15,14 @@ const ComponentPropValue: React.FunctionComponent = props => if (name === 'literal') return enum if (name === 'ShorthandValue' || name === 'ShorthandCollection') { const componentName = parameters[0].name.replace('Props', '') + const kindIsDefined = name === 'ShorthandCollection' && parameters[1].name !== 'never' return ( {name} {`<`} {parameters[0].name} + {kindIsDefined && , {parameters[1].name}} {`>`} ) diff --git a/packages/react/src/types.ts b/packages/react/src/types.ts index 2fd17fd904..8a14c2bd1d 100644 --- a/packages/react/src/types.ts +++ b/packages/react/src/types.ts @@ -72,7 +72,7 @@ type ReactNode = | undefined export type ShorthandValue

= ReactNode | Props

-export type ShorthandCollection = ShorthandValue

[] +export type ShorthandCollection = ShorthandValue

[] // ======================================================== // Types for As prop support