declaration-build.ts

Types for incremental declaration construction during analysis.

These types are used by the analysis layer (typescript-extract-*.ts, typescript-exports.ts, svelte.ts, tsdoc.ts) to build declarations before Zod validation. Most consumers work with the validated types from types.ts, but these are available for advanced use cases.

@see types.ts for consumer-facing Zod schemas (DeclarationJson, ModuleJson) @see typescript-exports.ts and typescript-extract-*.ts for TypeScript declaration analysis @see svelte.ts for Svelte component analysis

Declarations
#

6 declarations

view source

DeclarationAnalysis
#

declaration-build.ts view source

DeclarationAnalysis

Result of analyzing a single declaration.

Produced by analyzeDeclaration (in typescript-exports.ts) and Svelte component analysis. Used by analyzeModule to filter @nodocs declarations before output.

Uses DeclarationJsonBuild (not DeclarationJsonInput) because declarations are constructed incrementally — Zod validation happens at the ModuleJson.parse() boundary.

declaration

The analyzed declaration metadata (pre-validation).

nodocs

Whether the declaration is marked @nodocs (should be excluded from documentation).

type boolean

DeclarationJsonBuild
#

declaration-build.ts view source

DeclarationJsonBuild

Permissive type for constructing declarations incrementally before Zod validation.

Used by internal analysis functions (analyzeDeclaration, extractFunctionInfo, etc.) that build declarations by mutating a plain object. The discriminated union schema validates the final shape at the ModuleJson.parse() boundary.

name

type string

kind

docComment

type string

typeSignature

type string

modifiers

type Array<DeclarationModifier>

sourceLine

type number

parameters

type Array<z.input<typeof ParameterJson>>

returnType

type string

returnDescription

type string

genericParams

type Array<GenericParamJson>

overloads

type Array<OverloadJsonInput>

examples

type Array<string>

deprecatedMessage

type string

seeAlso

type Array<string>

throws

type Array<{type?: string; description: string}>

since

type string

mutates

type Record<string, string>

extends

type string | Array<string>

intersects

type Array<string>

implements

type Array<string>

members

type Array<MemberJsonBuild>

props

type Array<ComponentPropJsonInput>

acceptsChildren

type boolean

lang

type 'js'

alsoExportedFrom

type Array<string>

aliasOf

type {module: string; name: string}

reactivity

partial

type boolean

module

Source module path for kind: 'namespace' declarations (export * as ns from './x').

type string

defaultValue

Default value documented via @default. Variable declarations only.

type string

MemberJsonBuild
#

declaration-build.ts view source

MemberJsonBuild

Permissive type for constructing members incrementally before Zod validation.

Used by internal analysis functions in typescript-extract-*.ts that build members by mutating a plain object. The discriminated union schema (MemberJson) validates the final shape at the ModuleJson.parse() boundary.

Mirrors DeclarationJsonBuild for the same reason: construction sites determine kind at runtime, so TypeScript can't narrow the union during incremental field assignment.

name

type string

kind

docComment

type string

typeSignature

type string

modifiers

type Array<DeclarationModifier>

sourceLine

type number

genericParams

type Array<GenericParamJson>

parameters

type Array<z.input<typeof ParameterJson>>

returnType

type string

returnDescription

type string

overloads

type Array<OverloadJsonInput>

examples

type Array<string>

deprecatedMessage

type string

seeAlso

type Array<string>

throws

type Array<{type?: string; description: string}>

since

type string

mutates

type Record<string, string>

reactivity

partial

type boolean

optional

Whether the member has a ? token in its declaration. Function and variable members only.

type boolean

defaultValue

Default value documented via @default. Variable members only.

type string

ModuleAnalysis
#

declaration-build.ts view source

ModuleAnalysis

Result of analyzing a module (TypeScript or Svelte).

Produced by analyzeTypescriptModule and analyzeSvelteModule. Both analyzers return this same structure for uniform handling by analyzeModule in analyze-core.ts.

inheritance

path

Module path relative to source root.

type string

dependencies

Dependencies (other source modules this module imports). Empty if none.

type Array<string>

dependents

Dependents (other source modules that import this module). Empty if none.

type Array<string>

ModuleExportsAnalysis
#

declaration-build.ts view source

ModuleExportsAnalysis

Result of analyzing a module's exports.

Produced by analyzeExports in typescript-exports.ts.

moduleComment

Module-level documentation comment.

type string

declarations

All exported declarations with @nodocs flags — consumer filters based on policy.

type Array<DeclarationAnalysis>

reExports

Same-name re-exports (for building alsoExportedFrom in post-processing).

type Array<ReExportInfo>

starExports

Star exports (export * from './module') — module paths that are fully re-exported.

type Array<string>

ReExportInfo
#

declaration-build.ts view source

ReExportInfo

Information about a same-name re-export.

Collected during phase 1 of analysis and passed to mergeReExports in phase 2 to build alsoExportedFrom arrays on canonical declarations.

name

Name of the re-exported declaration. 'default' for default-slot re-exports (export {default} from './x') — that's the canonical's actual symbol name in the original module.

type string

originalModule

Module path (relative to sourceRoot) where the declaration is originally declared.

type string