MCPcopy Create free account
hub / github.com/effect-app/libs / functionSignature

Function functionSignature

repos/effect/packages/tools/jsdocs/src/Jsdocs.ts:2833–2872  ·  view source on GitHub ↗
(
  name: string,
  symbol: ts.Symbol,
  location: ts.Node,
  checker: ts.TypeChecker,
  cwd: string
)

Source from the content-addressed store, hash-verified

2831
2832function signatureParameterName(parameter: ts.Symbol): string {
2833 const declaration = signatureParameterDeclaration(parameter)
2834 if (declaration !== undefined && ts.isIdentifier(declaration.name)) return declaration.name.text
2835 return parameter.getName()
2836}
2837
2838function signatureFunctionThisKind(type: ts.Type, checker: ts.TypeChecker, location: ts.Node): string {
2839 const thisParameter = checker.getSignaturesOfType(type, ts.SignatureKind.Call)[0]?.thisParameter
2840 if (thisParameter === undefined) return "none"
2841 const thisType = checker.typeToString(
2842 checker.getTypeOfSymbolAtLocation(thisParameter, location),
2843 location,
2844 signatureTypeFormatFlags
2845 )
2846 return thisType === "unassigned" ? "unassigned" : "self"
2847}
2848
2849function isSignatureFunctionKind(kind: string): boolean {
2850 return kind.startsWith("body:") || kind.startsWith("function:")
2851}
2852
2853function signatureTransformCountKind(count: number): string {
2854 if (count <= 3) return String(count)
2855 if (count <= 7) return "4"
2856 if (count <= 15) return "8"
2857 return "16"
2858}
2859
2860function signatureParameterKind(
2861 parameter: ts.Symbol | undefined,
2862 checker: ts.TypeChecker,
2863 location: ts.Node
2864): string {
2865 if (parameter === undefined) return "none"
2866 const declaration = signatureParameterDeclaration(parameter)
2867 if (declaration?.dotDotDotToken !== undefined) return "rest"
2868 const name = signatureParameterName(parameter).replace(/_$/, "").toLowerCase()
2869 const type = checker.getTypeOfSymbolAtLocation(parameter, declaration ?? location)
2870 if (name === "self" || name === "that") return "self"
2871 if (name === "body") return `body:${signatureFunctionThisKind(type, checker, location)}`
2872 if (name === "name" || name === "spanname") return "name"
2873 if (name.includes("refinement")) return "refinement"
2874 if (name.includes("predicate")) return "predicate"
2875 if (name === "options" || name === "option" || name === "opts" || name === "config" || name === "args") {

Callers 1

symbolSignatureFunction · 0.85

Calls 8

resolvedSymbolTargetFunction · 0.85
representativeSignaturesFunction · 0.85
normalizeSignatureFunction · 0.85
parseableSignatureFunction · 0.85
signatureAliasFunction · 0.85
pushMethod · 0.80
joinMethod · 0.80
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…