diff options
Diffstat (limited to 'packages/react-docs')
-rw-r--r-- | packages/react-docs/src/components/signature.tsx | 2 | ||||
-rw-r--r-- | packages/react-docs/src/types.ts | 1 | ||||
-rw-r--r-- | packages/react-docs/src/utils/typedoc_utils.ts | 1 |
3 files changed, 4 insertions, 0 deletions
diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index 83fb1e246..1d3c90261 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -91,6 +91,7 @@ function renderParameters( ) { const params = _.map(parameters, (p: Parameter) => { const isOptional = p.isOptional; + const hasDefaultValue = !_.isUndefined(p.defaultValue); const type = ( <Type type={p.type} @@ -103,6 +104,7 @@ function renderParameters( <span key={`param-${p.type}-${p.name}`}> {p.name} {isOptional && '?'}: {type} + {hasDefaultValue && ` = ${p.defaultValue}`} </span> ); }); diff --git a/packages/react-docs/src/types.ts b/packages/react-docs/src/types.ts index 2a300c164..3b4a57ad5 100644 --- a/packages/react-docs/src/types.ts +++ b/packages/react-docs/src/types.ts @@ -140,6 +140,7 @@ export interface Parameter { comment: string; isOptional: boolean; type: Type; + defaultValue?: string; } export interface TypeParameter { diff --git a/packages/react-docs/src/utils/typedoc_utils.ts b/packages/react-docs/src/utils/typedoc_utils.ts index e9035def0..9c89b135a 100644 --- a/packages/react-docs/src/utils/typedoc_utils.ts +++ b/packages/react-docs/src/utils/typedoc_utils.ts @@ -395,6 +395,7 @@ export const typeDocUtils = { name: entity.name, comment, isOptional, + defaultValue: entity.defaultValue, type, }; return parameter; |