Skip to content

Commit

Permalink
fix: use the sublist for function param types is they are not provide…
Browse files Browse the repository at this point in the history
…d in the generic
  • Loading branch information
MarshallOfSound committed May 29, 2019
1 parent 132b6f3 commit 5bcfc94
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/markdown-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,23 @@ export const rawTypeToTypeInformation = (
// Special case, when the generic type is "Function" then the first N - 1 innerTypes are
// parameter types and the Nth innerType is the return type
if (genericTypeString === 'Function') {
const genericProvidedParams = innerTypes.slice(0, innerTypes.length - 2);

return {
collection,
type: 'Function',
parameters: innerTypes.slice(0, innerTypes.length - 2),
parameters:
// If no param types are provided in the <A, B, C> syntax then we should fallback to the normal one
genericProvidedParams.length === 0
? subTypedKeys
? subTypedKeys.map<MethodParameterDocumentation>(typedKey => ({
name: typedKey.key,
description: typedKey.description,
required: typedKey.required,
...typedKey.type,
}))
: []
: genericProvidedParams,
returns: innerTypes[innerTypes.length - 1],
};
}
Expand Down

0 comments on commit 5bcfc94

Please sign in to comment.