(
type: ts.TypeNode | undefined,
diagnostics: Array<JSDocModelDiagnostic>,
linkContext: { readonly checker: ts.TypeChecker; readonly entry: ProgramCacheEntry; readonly cwd: string }
)
| 2923 | } |
| 2924 | |
| 2925 | function representativeSignatures( |
| 2926 | signatures: ReadonlyArray<ts.Signature>, |
| 2927 | checker: ts.TypeChecker, |
| 2928 | location: ts.Node |
| 2929 | ): ReadonlyArray<ts.Signature> { |
| 2930 | const seen = new Set<string>() |
| 2931 | const out: Array<ts.Signature> = [] |
| 2932 | for (const signature of signatures) { |
| 2933 | const key = signatureShapeKey(signature, checker, location) |
| 2934 | if (seen.has(key)) continue |
| 2935 | seen.add(key) |
| 2936 | out.push(signature) |
| 2937 | } |
| 2938 | return out |
| 2939 | } |
| 2940 | |
| 2941 | function functionSignature( |
| 2942 | name: string, |
| 2943 | symbol: ts.Symbol, |
| 2944 | location: ts.Node, |
| 2945 | checker: ts.TypeChecker, |
| 2946 | cwd: string |
| 2947 | ): string | null { |
| 2948 | const target = resolvedSymbolTarget(symbol, checker) |
| 2949 | const type = checker.getTypeOfSymbolAtLocation(target, location) |
| 2950 | const signatures = checker.getSignaturesOfType(type, ts.SignatureKind.Call) |
| 2951 | if (signatures.length === 0) return null |
| 2952 | const callSignatures: Array<string> = [] |
| 2953 | for (const signature of representativeSignatures(signatures, checker, location)) { |
| 2954 | const text = normalizeSignature( |
| 2955 | cwd, |
| 2956 | checker.signatureToString(signature, location, signatureTypeFormatFlags, ts.SignatureKind.Call) |
| 2957 | ) |
| 2958 | if (text === null) return null |
| 2959 | callSignatures.push(text) |
| 2960 | } |
| 2961 | const declaration = parseableSignature( |
| 2962 | cwd, |
| 2963 | callSignatures.map((text) => `declare function ${name}${text}`).join("\n") |
| 2964 | ) |
no test coverage detected
searching dependent graphs…