aboutsummaryrefslogtreecommitdiffstats
path: root/packages/react-docs/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/react-docs/src')
-rw-r--r--packages/react-docs/src/components/documentation.tsx2
-rw-r--r--packages/react-docs/src/components/interface.tsx3
-rw-r--r--packages/react-docs/src/components/signature.tsx2
-rw-r--r--packages/react-docs/src/components/type.tsx1
-rw-r--r--packages/react-docs/src/types.ts1
-rw-r--r--packages/react-docs/src/utils/typedoc_utils.ts11
6 files changed, 15 insertions, 5 deletions
diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx
index 14fe175cf..800892dc8 100644
--- a/packages/react-docs/src/components/documentation.tsx
+++ b/packages/react-docs/src/components/documentation.tsx
@@ -337,7 +337,7 @@ export class Documentation extends React.Component<DocumentationProps, Documenta
return (
<div key={`property-${property.name}-${property.type.name}`} className="pb3">
<code className={`hljs ${constants.TYPE_TO_SYNTAX[this.props.docsInfo.type]}`}>
- {property.name}:
+ {property.name}:{' '}
<Type type={property.type} sectionName={sectionName} docsInfo={this.props.docsInfo} />
</code>
{property.source && (
diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx
index 541e164e3..bdfdf47c4 100644
--- a/packages/react-docs/src/components/interface.tsx
+++ b/packages/react-docs/src/components/interface.tsx
@@ -19,7 +19,7 @@ export function Interface(props: InterfaceProps) {
return (
<span key={`property-${property.name}-${property.type}-${type.name}`}>
{property.name}:{' '}
- {property.type.typeDocType !== TypeDocTypes.Reflection ? (
+ {property.type && property.type.typeDocType !== TypeDocTypes.Reflection ? (
<Type type={property.type} sectionName={props.sectionName} docsInfo={props.docsInfo} />
) : (
<Signature
@@ -27,7 +27,6 @@ export function Interface(props: InterfaceProps) {
returnType={property.type.method.returnType}
parameters={property.type.method.parameters}
typeParameter={property.type.method.typeParameter}
- callPath={property.type.method.callPath}
sectionName={props.sectionName}
shouldHideMethodName={true}
shouldUseArrowSyntax={true}
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/components/type.tsx b/packages/react-docs/src/components/type.tsx
index fd4562ce3..2b7b49672 100644
--- a/packages/react-docs/src/components/type.tsx
+++ b/packages/react-docs/src/components/type.tsx
@@ -109,7 +109,6 @@ export function Type(props: TypeProps): any {
returnType={type.method.returnType}
parameters={type.method.parameters}
typeParameter={type.method.typeParameter}
- callPath={type.method.callPath}
sectionName={props.sectionName}
shouldHideMethodName={true}
shouldUseArrowSyntax={true}
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 02f5b4049..9c89b135a 100644
--- a/packages/react-docs/src/utils/typedoc_utils.ts
+++ b/packages/react-docs/src/utils/typedoc_utils.ts
@@ -14,6 +14,7 @@ import {
Type,
TypeDocNode,
TypeDocType,
+ TypeDocTypes,
TypeParameter,
TypescriptFunction,
TypescriptMethod,
@@ -221,9 +222,16 @@ export const typeDocUtils = {
const childrenIfExist = !_.isUndefined(entity.children)
? _.map(entity.children, (child: TypeDocNode) => {
- const childTypeIfExists = !_.isUndefined(child.type)
+ let childTypeIfExists = !_.isUndefined(child.type)
? typeDocUtils._convertType(child.type, sections, sectionName, docId)
: undefined;
+ if (child.kindString === KindString.Method) {
+ childTypeIfExists = {
+ name: child.name,
+ typeDocType: TypeDocTypes.Reflection,
+ method: this._convertMethod(child, isConstructor, sections, sectionName, docId),
+ };
+ }
const c: CustomTypeChild = {
name: child.name,
type: childTypeIfExists,
@@ -387,6 +395,7 @@ export const typeDocUtils = {
name: entity.name,
comment,
isOptional,
+ defaultValue: entity.defaultValue,
type,
};
return parameter;