diff --git a/code/lib/docs-tools/src/argTypes/docgen/createPropDef.ts b/code/lib/docs-tools/src/argTypes/docgen/createPropDef.ts index f04c2b34baf2..289ea0fff9d7 100644 --- a/code/lib/docs-tools/src/argTypes/docgen/createPropDef.ts +++ b/code/lib/docs-tools/src/argTypes/docgen/createPropDef.ts @@ -1,4 +1,4 @@ -import type { JsDocTags, PropDefaultValue } from './PropDef'; +import type { JsDocParam, JsDocTags, PropDefaultValue } from './PropDef'; import type { PropDef, DocgenInfo, DocgenType, DocgenPropDefaultValue } from './types'; import { TypeSystem } from './types'; import type { JsDocParsingResult } from '../jsdocParser'; @@ -90,13 +90,15 @@ function applyJsDocResult(propDef: PropDef, jsDocParsingResult?: JsDocParsingRes propDef.description = jsDocParsingResult.description; } - const value: JsDocTags = { - returns: extractedTags?.returns, - params: extractedTags?.params?.map((x) => ({ - name: x.getPrettyName(), - description: x.description, - })), - }; + const value = { + ...extractedTags, + params: extractedTags?.params?.map( + (x): JsDocParam => ({ + name: x.getPrettyName(), + description: x.description, + }) + ), + } satisfies JsDocTags; if (Object.values(value).filter(Boolean).length > 0) { // eslint-disable-next-line no-param-reassign diff --git a/code/lib/docs-tools/src/argTypes/jsdocParser.ts b/code/lib/docs-tools/src/argTypes/jsdocParser.ts index 8bdd82102bc3..a8a8fe502fa8 100644 --- a/code/lib/docs-tools/src/argTypes/jsdocParser.ts +++ b/code/lib/docs-tools/src/argTypes/jsdocParser.ts @@ -1,17 +1,15 @@ import type { Annotation } from 'doctrine'; import doctrine from 'doctrine'; +import type { JsDocParam, JsDocReturns } from './docgen'; -export interface ExtractedJsDocParam { - name?: string; +export interface ExtractedJsDocParam extends JsDocParam { type?: any; - description?: string | null; getPrettyName: () => string | undefined; getTypeName: () => string | null; } -export interface ExtractedJsDocReturns { +export interface ExtractedJsDocReturns extends JsDocReturns { type?: any; - description?: string | null; getTypeName: () => string | null; }