aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-04-11 16:39:30 +0800
committerFabio Berger <me@fabioberger.com>2018-04-11 16:39:30 +0800
commitbce97c2543d8f1f4fef3e65086d25ed37977b361 (patch)
treee594408b570db0c93595e9c087703d6cbedc3c3d
parent34446cf5697a58a130c16f480bf021e707708982 (diff)
downloaddexon-sol-tools-bce97c2543d8f1f4fef3e65086d25ed37977b361.tar
dexon-sol-tools-bce97c2543d8f1f4fef3e65086d25ed37977b361.tar.gz
dexon-sol-tools-bce97c2543d8f1f4fef3e65086d25ed37977b361.tar.bz2
dexon-sol-tools-bce97c2543d8f1f4fef3e65086d25ed37977b361.tar.lz
dexon-sol-tools-bce97c2543d8f1f4fef3e65086d25ed37977b361.tar.xz
dexon-sol-tools-bce97c2543d8f1f4fef3e65086d25ed37977b361.tar.zst
dexon-sol-tools-bce97c2543d8f1f4fef3e65086d25ed37977b361.zip
Add support for displaying default param values
-rw-r--r--packages/react-docs/src/components/signature.tsx2
-rw-r--r--packages/react-docs/src/types.ts1
-rw-r--r--packages/react-docs/src/utils/typedoc_utils.ts1
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;