( assertCall: ts.CallExpression, diagnosticsByFile: DiagnosticsByFile )
| 62 | } |
| 63 | |
| 64 | export const analyzeAssertCall = ( |
| 65 | assertCall: ts.CallExpression, |
| 66 | diagnosticsByFile: DiagnosticsByFile |
| 67 | ): TypeAssertionData => { |
| 68 | const types = extractArgumentTypesFromCall(assertCall) |
| 69 | const location = getCallLocationFromCallExpression(assertCall) |
| 70 | const args = types.args.map(arg => serializeArg(arg, types)) |
| 71 | const typeArgs = types.typeArgs.map(typeArg => serializeArg(typeArg, types)) |
| 72 | const errors = checkDiagnosticMessages(assertCall, diagnosticsByFile) |
| 73 | const completions = getCompletions(assertCall) |
| 74 | |
| 75 | // Extract JSDoc comment for first argument if available |
| 76 | const jsdoc = extractJSDocFromArgument(assertCall) |
| 77 | |
| 78 | const result: TypeAssertionData = { |
| 79 | location, |
| 80 | args, |
| 81 | typeArgs, |
| 82 | errors, |
| 83 | completions |
| 84 | } |
| 85 | |
| 86 | if (jsdoc) result.jsdoc = jsdoc |
| 87 | |
| 88 | return result |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Extract JSDoc comments associated with the first argument of a call expression |
no test coverage detected