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

view source

Declarations
#

5 declarations

DeclarationAnalysis
#

declaration-build.ts view source

DeclarationAnalysis import type {DeclarationAnalysis} from 'svelte-docinfo/declaration-build.js';

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

type DeclarationJsonBuild

nodocs

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

type boolean

DeclarationJsonBuild
#

declaration-build.ts view source

DeclarationJsonBuild import type {DeclarationJsonBuild} from 'svelte-docinfo/declaration-build.js';

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

type DeclarationKind

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?

type 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 import type {MemberJsonBuild} from 'svelte-docinfo/declaration-build.js';

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

type MemberKind

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?

type 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 import type {ModuleAnalysis} from 'svelte-docinfo/declaration-build.js';

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 import type {ModuleExportsAnalysis} from 'svelte-docinfo/declaration-build.js';

Result of analyzing a module's exports.

Produced by analyzeExports in typescript-exports.ts.

moduleComment?

Module-level documentation comment. Always undefined for svelte2tsx virtual files — analyzeSvelteModule extracts Svelte module comments from the original source instead.

type string

declarations

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

type Array<DeclarationAnalysis>

reExports

Same-name re-exports. Published as ModuleJson.reExports and consumed by mergeReExports in phase 2 to build alsoExportedFrom arrays on canonical declarations. Unsorted here and may contain exact duplicates (Svelte default-slot re-keying) — ordering and dedup are applied at publication in analyze-core.ts.

type Array<ReExportJsonInput>

starExports

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

type Array<string>

externalReExports

Direct re-exports from external packages. Published as ModuleJson.externalReExports; unsorted here, sorted at publication.

type Array<ExternalReExportJsonInput>

externalStarExports

External star exports (export * from 'pkg') — specifiers as written.

type Array<string>

Depends on
#

Imported by
#