typescript-extract-type.ts

internal

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

extractTypeInfo handles type aliases and interfaces (including index/method/ call/construct signatures, intersection filtering, and the members an interface's computed heritage contributes). 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 also

  • ``typescript-extract-shared.ts`` for shared helpers

  • ``typescript-extract-type-properties.ts`` for type-alias property walking

view source

Declarations
#

2 declarations

extractEnumInfo
#

typescript-extract-type.ts view source

internal

Used by `analyzeDeclaration` — not part of the public barrel export.

(node: Node, declaration: DeclarationJsonBuild, ctx: ExtractContext): void import {extractEnumInfo} from 'svelte-docinfo/typescript-extract-type.js';

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'.

A JS @enum {T} const (isJSDocEnumSymbol) arrives as its variable declaration. Its typeSignature is the tag's type, T, the type the name means in an annotation (@param {A} a takes any T), and its members are the value's properties in declaration order, each with its own JSDoc and checker type.

node

type Node

declaration

ctx

returns

void

mutates

  • declaration — adds members and typeSignature

extractTypeInfo
#

typescript-extract-type.ts view source

internal

Used by `analyzeDeclaration` — not part of the public barrel export.

(node: Node, declaration: DeclarationJsonBuild, ctx: ExtractContext): void import {extractTypeInfo} from 'svelte-docinfo/typescript-extract-type.js';

Extract type/interface information with rich property metadata.

node

the declaration AST node

type Node

declaration

the declaration to populate

ctx

the extraction pass's context

returns

void

mutates

  • declaration — adds typeSignature, genericParams, extends, externalTypes, members (and `partial: true` on extraction failure)
  • ctx.diagnostics — adds `type_extraction_failed` / `signature_analysis_failed` diagnostics on checker errors

Depends on
#

Imported by
#