Silently ignore identifiers with missing types
This commit is contained in:
parent
21075b81a6
commit
587ac52c05
1 changed files with 14 additions and 3 deletions
17
src/main.ts
17
src/main.ts
|
@ -19,6 +19,15 @@ function flatten<A>(xss: A[][]): A[] {
|
|||
return ([] as A[]).concat(...xss)
|
||||
}
|
||||
|
||||
function silently<A>(m: () => A): A | undefined {
|
||||
try {
|
||||
return m()
|
||||
} catch (e) {
|
||||
// console.error(e)
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
|
||||
type Top = {filename: string, defs: Defs}[]
|
||||
|
||||
type Defs = Def[]
|
||||
|
@ -101,9 +110,11 @@ function generateDocumentation(program: ts.Program, filenames: string[]): Top {
|
|||
|| ts.isClassDeclaration(node)
|
||||
|| ts.isTypeAliasDeclaration(node),
|
||||
type:
|
||||
(symbol.valueDeclaration && !ts.isClassDeclaration(node))
|
||||
? checker.typeToString(checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration), node, 65535)
|
||||
: undefined,
|
||||
silently(() =>
|
||||
(symbol.valueDeclaration && !ts.isClassDeclaration(node))
|
||||
? checker.typeToString(checker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration), node, 65535)
|
||||
: undefined
|
||||
),
|
||||
children: []
|
||||
}
|
||||
if ( ts.isInterfaceDeclaration(node) ) {
|
||||
|
|
Loading…
Add table
Reference in a new issue