Skip to content

Commit

Permalink
fix: fix showing type annotations for ts
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Jun 25, 2019
1 parent cb88ce6 commit abb9875
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/templates/Documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ const ANNOTATION_OPTIONAL = '@optional';
const ANNOTATION_INTERNAL = '@internal';
const ANNOTATION_EXTENDS = '@extends';

const getTypeName = (flowType: TypeAnnotation) =>
flowType.raw || flowType.name || '';
const getTypeName = (type: TypeAnnotation) => type.raw || type.name || '';

const hasAnnotation = (item: any, annotation: string) =>
// eslint-disable-next-line no-nested-ternary
Expand All @@ -89,6 +88,7 @@ const PropTypeDoc = ({
name,
description,
flowType,
tsType,
type,
required,
defaultValue,
Expand All @@ -100,7 +100,7 @@ const PropTypeDoc = ({

const typeName =
// eslint-disable-next-line no-nested-ternary
flowType ? getTypeName(flowType) : type ? getTypeName(type) : null;
flowType || tsType || type ? getTypeName(flowType || tsType || type) : null;

return (
<PropInfo>
Expand Down
1 change: 1 addition & 0 deletions src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export type Docs = {
value: string | number,
},
flowType?: TypeAnnotation,
tsType?: TypeAnnotation,
type?: TypeAnnotation,
},
},
Expand Down

0 comments on commit abb9875

Please sign in to comment.