Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/__tests__/data/JSDocWithParam.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as React from 'react';

/** JSDocWithParamProps props */
export interface JSDocWithParamProps {
/** prop1 description */
prop1: string;
}

/**
* JSDocWithParamProps description
*
* NOTE: If a parent element of this control is `overflow: hidden` then the
* balloon may not show up.
*
* @param props Control properties (defined in `SimpleDropdownProps` interface)
*/
export const JSDocWithParam = (props: JSDocWithParamProps) => {
return <div>Test</div>;
};
13 changes: 13 additions & 0 deletions src/__tests__/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,19 @@ describe('parser', () => {
});
});

it('should parse JSDoc correctly', () => {
check(
'JSDocWithParam',
{
JSDocWithParam: {
prop1: { type: 'string', required: true }
}
},
true,
'JSDocWithParamProps description\n\nNOTE: If a parent element of this control is `overflow: hidden` then the\nballoon may not show up.'
);
});

it('should parse functional component component defined as const as default export', () => {
check(
'FunctionalComponentAsConstAsDefaultExport',
Expand Down
2 changes: 1 addition & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export class Parser {
const resolvedComponentName = componentNameResolver(nameSource, source);
const displayName =
resolvedComponentName || computeComponentName(nameSource, source);
const description = this.findDocComment(commentSource).fullComment;
const { description } = this.findDocComment(commentSource);
const methods = this.getMethodsInfo(type);

if (propsType) {
Expand Down