(node: ts.Node)
| 102 | } |
| 103 | |
| 104 | function visit(node: ts.Node) { |
| 105 | if (ts.isVariableStatement(node)) { |
| 106 | const varStatement = node as ts.VariableStatement |
| 107 | varStatement.declarationList.declarations.forEach((declaration) => { |
| 108 | const varName = (declaration.name as ts.Identifier).escapedText |
| 109 | if (allowedGlobals.includes(varName.toString())) { |
| 110 | globalVariables.push(serializeVariableDeclaration(declaration)) |
| 111 | const varType = checker.getTypeAtLocation(declaration.name) |
| 112 | serializeType(varType) |
| 113 | } |
| 114 | if (manualTypeVariables.includes(varName.toString())) { |
| 115 | const varType = checker.getTypeAtLocation(declaration.name) |
| 116 | serializeType(varType) |
| 117 | } |
| 118 | }) |
| 119 | } |
| 120 | if (ts.isFunctionDeclaration(node)) { |
| 121 | const funcDec = node as ts.FunctionDeclaration |
| 122 | const signature = checker.getSignatureFromDeclaration(funcDec) |
| 123 | const funcDefSummary: FunctionDefinition = { |
| 124 | name: funcDec.name.getText(), |
| 125 | deprecated: false, |
| 126 | type: { |
| 127 | parameters: funcDec.parameters.map((paramDeclaration) => { |
| 128 | return { |
| 129 | name: paramDeclaration.name.getText(), |
| 130 | type: serializeTypeExpression(paramDeclaration.type), |
| 131 | deprecated: false, |
| 132 | documentation: '', |
| 133 | } |
| 134 | }), |
| 135 | returnType: serializeTypeExpression(funcDec.type), |
| 136 | }, |
| 137 | documentation: serializeDocumentation(signature.getDocumentationComment(checker)), |
| 138 | } |
| 139 | globalFunctions.push(funcDefSummary) |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | function serializeFunctionTypeExpression(funcType: ts.FunctionTypeNode): FunctionTypeDefinition { |
| 144 | return { |
nothing calls this directly
no test coverage detected