Skip to content

Commit

Permalink
Fix: Use doctrine to stringify types (fixes styleguidist#1611)
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacbuckman committed Jul 3, 2020
1 parent a45e213 commit 5f6329c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/rsg-components/Argument/ArgumentRenderer.tsx
Expand Up @@ -5,6 +5,7 @@ import Markdown from 'rsg-components/Markdown';
import Name from 'rsg-components/Name';
import Type from 'rsg-components/Type';
import Group from 'react-group';
import doctrine from 'doctrine';
import * as Rsg from '../../../typings';

export const styles = ({ space }: Rsg.Theme) => ({
Expand Down Expand Up @@ -38,6 +39,7 @@ export const ArgumentRenderer: React.FunctionComponent<ArgumentPropsWithClasses>
if (isOptional) {
type = type.expression;
}
const typeName = doctrine.type.stringify(type);
const content = (
<Group>
{returns && 'Returns'}
Expand All @@ -49,7 +51,7 @@ export const ArgumentRenderer: React.FunctionComponent<ArgumentPropsWithClasses>
)}
{type && (
<Type>
{type.name}
{typeName}
{isOptional && '?'}
{!!defaultValue && `=${defaultValue}`}
</Type>
Expand Down

0 comments on commit 5f6329c

Please sign in to comment.