MCPcopy Create free account
hub / github.com/arktypeio/arktype / analyzeAssertCall

Function analyzeAssertCall

ark/attest/cache/writeAssertionCache.ts:64–89  ·  view source on GitHub ↗
(
	assertCall: ts.CallExpression,
	diagnosticsByFile: DiagnosticsByFile
)

Source from the content-addressed store, hash-verified

62}
63
64export 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

Callers 1

getAssertionsInFileFunction · 0.70

Calls 7

checkDiagnosticMessagesFunction · 0.85
extractJSDocFromArgumentFunction · 0.85
serializeArgFunction · 0.70
getCompletionsFunction · 0.70
mapMethod · 0.65

Tested by

no test coverage detected