typescript-extract-function.ts

Per-declaration extractors for TypeScript functions and variables.

Both extractFunctionInfo and extractVariableInfo mutate a DeclarationJsonBuild with rich metadata derived from the TypeScript checker. Called by analyzeDeclaration in typescript-exports.ts once kind dispatch is settled.

@see typescript-extract-shared.ts for shared helpers (signatures, overloads, generics, reactivity)

view source

Declarations
#

2 declarations

extractFunctionInfo
#

typescript-extract-function.ts view source

(node: Node, symbol: Symbol, checker: TypeChecker, declaration: DeclarationJsonBuild, tsdoc: TsdocParsedComment | undefined, diagnostics: ({ ...; } | ... 12 more ... | { ...; })[]): void import {extractFunctionInfo} from 'svelte-docinfo/typescript-extract-function.js';

Extract function/method information including parameters with descriptions and default values.

node

the declaration AST node

type Node

symbol

the TypeScript symbol

type Symbol

checker

TypeScript type checker

type TypeChecker

declaration

the declaration to populate

tsdoc

parsed TSDoc comment (if available)

type TsdocParsedComment | undefined

diagnostics

diagnostics collector for non-fatal issues

type ({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | { functionName: string; ... 5 more ...; column?: number | undefined; } | ... 11 more ... | { ...; })[]

returns

void

mutates

  • declaration — adds typeSignature, returnType, returnDescription, parameters, genericParams, overloads (and `partial: true` on signature failure)
  • diagnostics — adds `signature_analysis_failed` diagnostic on checker error

extractVariableInfo
#

typescript-extract-function.ts view source

(node: Node, symbol: Symbol, checker: TypeChecker, declaration: DeclarationJsonBuild, diagnostics: ({ symbolName: string; file: string; ... 4 more ...; column?: number | undefined; } | ... 12 more ... | { ...; })[]): void import {extractVariableInfo} from 'svelte-docinfo/typescript-extract-function.js';

Extract variable information.

node

the declaration AST node

type Node

symbol

the TypeScript symbol

type Symbol

checker

TypeScript type checker

type TypeChecker

declaration

the declaration to populate

diagnostics

diagnostics collector for non-fatal issues

type ({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | { functionName: string; ... 5 more ...; column?: number | undefined; } | ... 11 more ... | { ...; })[]

returns

void

mutates

  • declaration — adds typeSignature, reactivity (when initialized with a Svelte rune)

Depends on
#

Imported by
#