typescript-extract-type.ts

Per-declaration extractors for TypeScript type aliases, interfaces, and enums.

extractTypeInfo handles type aliases and interfaces (including index/method/ call/construct signatures and intersection filtering). extractEnumInfo handles regular and const enums. Both mutate a DeclarationJsonBuild with rich metadata derived from the TypeScript checker. Called by analyzeDeclaration in typescript-exports.ts once kind dispatch is settled.

Type-alias property walking (named properties, index/call/construct signatures) lives in typescript-extract-type-properties.ts to keep this module focused on top-level dispatch.

@see typescript-extract-shared.ts for shared helpers @see typescript-extract-type-properties.ts for type-alias property walking

Declarations
#

2 declarations

view source

extractEnumInfo
#

typescript-extract-type.ts view source

(node: Node, checker: TypeChecker, declaration: DeclarationJsonBuild, diagnostics: ({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | ... 12 more ... | { ...; })[]): void

Extract enum member information from an enum declaration.

Iterates node.members to extract each enum member's name, initializer value, type, and JSDoc. Members are represented as MemberJson with kind 'variable'.

node

type Node

checker

type TypeChecker

declaration

diagnostics

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

extractTypeInfo
#

typescript-extract-type.ts view source

(node: Node, checker: TypeChecker, declaration: DeclarationJsonBuild, diagnostics: ({ symbolName: string; file: string; message: string; severity: "error" | "warning"; kind: "type_extraction_failed"; line?: number | undefined; column?: number | undefined; } | ... 12 more ... | { ...; })[], isExternalFile: IsExternalFile): void

Extract type/interface information with rich property metadata.

node

the declaration AST node

type Node

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 ... | { ...; })[]

isExternalFile

returns

void

Depends on
#

Imported by
#