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 "function" | "type" | "variable" | "class" | "interface" | "enum" | "component" | "snippet" | "namespace"

docComment?

type string

typeSignature?

type string

modifiers?

type ("public" | "protected" | "readonly" | "static" | "abstract" | "getter" | "setter")[]

sourceLine?

type number

parameters?

type { name: string; type: string; typeInfo?: TypeJson | undefined; optional?: boolean | undefined; rest?: boolean | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]

returnType?

type string

returnTypeInfo?

type TypeJson

returnDescription?

type string

genericParams?

type { name: string; constraint?: string | undefined; defaultType?: string | undefined; }[]

overloads?

type { typeSignature: string; parameters?: { name: string; type: string; typeInfo?: TypeJson | undefined; optional?: boolean | undefined; rest?: boolean | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[] | undefined; ... 4 more ...; return...

examples?

type string[]

deprecatedMessage?

type string

internalMessage?

type string

seeAlso?

type string[]

throws?

type { type?: string | undefined; description: string; }[]

since?

type string

mutates?

type Record<string, string>

extends?

type string[]

externalTypes?

type string[]

implements?

type string[]

members?

type MemberJsonBuild[]

props?

type { name: string; type: string; examples?: string[] | undefined; deprecatedMessage?: string | undefined; seeAlso?: string[] | undefined; throws?: { description: string; type?: string | undefined; }[] | undefined; ... 6 more ...; parameters?: { ...; }[] | undefined; }[]

acceptsChildren?

type boolean

lang?

type "js"

alsoExportedFrom?

type string[]

aliasOf?

type { module: string; name: string; }

reactivity?

type "$state" | "$state.raw" | "$derived" | "$derived.by"

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

mergedValue?

The exported name also carries a value meaning. Type/interface declarations only.

type boolean

typeInfo?

Structured type. Variable and type-alias declarations only; see TypeJson.

type TypeJson

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 "function" | "variable" | "constructor"

docComment?

type string

typeSignature?

type string

modifiers?

type ("public" | "protected" | "readonly" | "static" | "abstract" | "getter" | "setter")[]

sourceLine?

type number

genericParams?

type { name: string; constraint?: string | undefined; defaultType?: string | undefined; }[]

parameters?

type { name: string; type: string; typeInfo?: TypeJson | undefined; optional?: boolean | undefined; rest?: boolean | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]

returnType?

type string

returnTypeInfo?

type TypeJson

returnDescription?

type string

overloads?

type { typeSignature: string; parameters?: { name: string; type: string; typeInfo?: TypeJson | undefined; optional?: boolean | undefined; rest?: boolean | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[] | undefined; ... 4 more ...; return...

examples?

type string[]

deprecatedMessage?

type string

internalMessage?

type string

seeAlso?

type string[]

throws?

type { type?: string | undefined; description: string; }[]

since?

type string

mutates?

type Record<string, string>

reactivity?

type "$state" | "$state.raw" | "$derived" | "$derived.by"

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 and function members only.

type string

typeInfo?

Structured type. Variable members only; see TypeJson.

type TypeJson

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 string[]

dependents

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

type 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 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 { name: string; module: string; typeOnly?: boolean | undefined; sourceLine?: number | undefined; }[]

starExports

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

type string[]

externalReExports

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

type { name: string; specifier: string; originalName?: string | undefined; typeOnly?: boolean | undefined; sourceLine?: number | undefined; }[]

externalStarExports

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

type string[]

Depends on
#

Imported by
#