@raycast/generate-docs
Advanced tools
Comparing version 0.8.0 to 0.8.1
{ | ||
"name": "@raycast/generate-docs", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
61
utils.js
@@ -159,5 +159,11 @@ // @ts-check | ||
if (!foundAnchor && alias === "Form.Value") { | ||
// we make a special case for Form.Value since we don't want to document it | ||
return "any"; | ||
} | ||
if (!foundAnchor) { | ||
console.log( | ||
item, | ||
alias, | ||
[...namesMap.keys()].filter( | ||
@@ -167,3 +173,7 @@ (k) => k === item.name || k.endsWith(`.${item.name}`) | ||
); | ||
throw new Error("Could not find anchor for " + item.name); | ||
throw new Error( | ||
`Could not find a header in the markdown docs for "${ | ||
alias || item.name | ||
}" so we could not generate the link` | ||
); | ||
} | ||
@@ -227,6 +237,48 @@ return `{@link ${foundAnchor}}`; | ||
if (interface.kindString === "Type alias") { | ||
return idsMap.get(interface.type.id); | ||
if ( | ||
interface.kindString === "Type alias" && | ||
interface.type.type === "reference" | ||
) { | ||
return getPropsFromInterface(idsMap.get(interface.type.id)); | ||
} | ||
if (interface.type?.type === "intersection") { | ||
let children = []; | ||
function findChildren(x) { | ||
if (x.children) { | ||
children = children.concat(x.children); | ||
return; | ||
} | ||
if (x.type === "intersection" || x.type === "union") { | ||
return x.types.forEach(findChildren); | ||
} | ||
if (x.type === "reflection") { | ||
return findChildren(x.declaration); | ||
} | ||
} | ||
findChildren(interface.type); | ||
return { | ||
...interface, | ||
children: children.filter( | ||
(x) => | ||
x.kindString !== "Constructor" && | ||
x.kindString !== "Method" && | ||
!x.flags?.isPrivate | ||
), | ||
}; | ||
} | ||
if (interface.type?.type === "reflection") { | ||
let children = interface.type.declaration.children; | ||
return { | ||
...interface, | ||
children: children.filter( | ||
(x) => | ||
x.kindString !== "Constructor" && | ||
x.kindString !== "Method" && | ||
!x.flags?.isPrivate | ||
), | ||
}; | ||
} | ||
return { | ||
@@ -301,3 +353,4 @@ ...interface, | ||
type.declaration?.kindString === "Type literal" && | ||
type.declaration.signatures[0].type.qualifiedName === "global.JSX.Element" | ||
type.declaration.signatures?.[0].type.qualifiedName === | ||
"global.JSX.Element" | ||
) { | ||
@@ -304,0 +357,0 @@ return true; |
29198
884