Skip to content

Commit

Permalink
fix: Ensure returns for function type definitions (#8346)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiralite committed Jul 24, 2022
1 parent af837de commit 59a7e52
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/docgen/src/interfaces/var-type.interface.ts
@@ -1,6 +1,7 @@
import type { Type } from './index.js';

export interface VarType extends Type {
type?: Required<Type>;
description?: string;
nullable?: boolean;
}
2 changes: 1 addition & 1 deletion packages/docgen/src/types/var-type.ts
Expand Up @@ -21,7 +21,7 @@ export class DocumentedVarType extends DocumentedItem<VarType> {
}

const data = this.data;
const names = data.names?.map((name) => splitVarName(name));
const names = (data.names ?? data.type?.names)?.map((name) => splitVarName(name));

if (!data.description && !data.nullable) {
return names;
Expand Down

1 comment on commit 59a7e52

@vercel
Copy link

@vercel vercel bot commented on 59a7e52 Jul 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.