types.ts

Metadata types for library source code analysis.

These types represent the structure of src/lib/ exports, extracted at build time via TypeScript compiler analysis. Used for generating API documentation and enabling code search.

Hierarchy: ModuleJsonDeclarationJson (discriminated union on kind) → MemberJson (discriminated union on kind)

Zod input/output split

Array fields use .default([]) so they're optional in serialized JSON (compact) but guaranteed [] at runtime after .parse(). Input types (ModuleJsonInput, DeclarationJsonInput, ComponentPropJsonInput) accept optional arrays; output types (ModuleJson, DeclarationJson, ComponentPropJson) guarantee arrays. Use compactReplacer (in declaration-helpers.ts) with JSON.stringify for compact output.

Discriminated union

DeclarationJson is a z.discriminatedUnion on kind with 9 variants: FunctionDeclarationJson, ClassDeclarationJson, InterfaceDeclarationJson, TypeDeclarationJson, VariableDeclarationJson, EnumDeclarationJson, ComponentDeclarationJson, SnippetDeclarationJson, NamespaceDeclarationJson. Each variant has only the fields relevant to that kind, enforced by z.strictObject. Use isKind (in declaration-helpers.ts) to narrow.

MemberJson is similarly a z.discriminatedUnion on kind with 3 variants: FunctionMemberJson, VariableMemberJson, ConstructorMemberJson. Each variant has only the fields relevant to that member kind.

Internal analysis code that constructs declarations incrementally uses DeclarationJsonBuild — a permissive interface with all fields optional. Zod validation at the ModuleJson.parse() boundary enforces variant correctness.

@see declaration-helpers.ts for display formatting and type narrowing utilities @see analyze.ts for the main analysis entry points @see tsdoc.ts for JSDoc/TSDoc extraction into these types @see postprocess.ts for post-processing (mergeReExports, findDuplicates)

view source

Declarations
#

35 declarations

ClassDeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "class"; extends: string[]; externalTypes: string[]; implements: string[]; members: ({ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; ... 4 more ...; propertyDescriptions?: Record<...> | undefined; }[]; ... 17 more ...; sourceLine?: number | un... import {ClassDeclarationJson} from 'svelte-docinfo/types.js';

A class declaration. Has members, extends, implements.

kind

type "class"

extends

Extended base class — 0 or 1 entries (TypeScript allows only one base). An array so every heritage field (extends, implements, externalTypes, InterfaceDeclarationJson.extends) shares one shape; consumers iterate heritage uniformly instead of branching on kind.

Verbatim text of this declaration's own heritage clause (as is implements), so it is spelled as this module wrote it and resolves in its scope — a local rename stays the local name, where externalTypes resolves renames because its walk crosses modules.

type string[]

see also

  • ``implements`` (this variant), InterfaceDeclarationJson.extends for the other verbatim heritage fields, externalTypes (this variant) for the resolved external reach.

externalTypes

External types the extends chain reaches whose contributions members never enumerates — the class counterpart of InterfaceDeclarationJson.externalTypes, descending through local base classes. implements contributes nothing: an implemented interface adds no members, the class declares its own.

Entry normalization (rename resolution, type-parameter substitution, text-dedupe, source order) matches TypeDeclarationJson.externalTypes.

type string[]

implements

Implemented interfaces.

type string[]

members

Class members: methods, properties, constructors, getters/setters — own members only, inherited members excluded whatever their origin.

type ({ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 17 more ...; sourceLine?: nu...

alsoExportedFrom

Module paths (relative to sourceRoot) that re-export this declaration under the same name. The canonical declaration lives in this module's declarations array; these paths are additional import locations for the same thing.

The same edges appear from the re-exporting side as ModuleJson.reExports — use that when asking "what does this module re-export" instead of inverting these arrays. The two can disagree at the margins: a reExports entry whose canonical declaration is @nodocs (or whose module isn't in the analyzed set) has no back-link here.

Consumer note: To build a complete re-export map, scan two fields:

  1. alsoExportedFrom on each declaration — same-name re-exports
  2. aliasOf on declarations — renamed re-exports (separate declarations)

type string[]

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

aliasOf?

For renamed re-exports (export {foo as bar}), points to the original declaration. This declaration's name is the alias; aliasOf.name is the original name.

For renames out of the default slot (export {default as bar} from './x' where ./x is export default ...), aliasOf.name is 'default' — the canonical's actual symbol name. Consumers locate the canonical by (aliasOf.module, aliasOf.name).

Svelte component exception: when the source is a .svelte file (e.g., export {default as Foo} from './X.svelte'), the canonical's name is the component name (derived from the filename), so aliasOf.name is the component name ('X'), NOT 'default'. Consumers that branch on aliasOf.name === 'default' to detect default-rename should additionally check whether aliasOf.module ends with .svelte.

Different from alsoExportedFrom: aliases create new API surface names, while alsoExportedFrom tracks additional import paths for the same name.

type { module: string; name: string; }

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

ComponentDeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "component"; externalTypes: string[]; props: { examples: string[]; seeAlso: string[]; throws: { description: string; type?: string | undefined; }[]; name: string; type: string; optional: boolean; bindable: boolean; ... 5 more ...; parameters?: { ...; }[] | undefined; }[]; ... 17 more ...; sourceLine?: number... import {ComponentDeclarationJson} from 'svelte-docinfo/types.js';

A Svelte component declaration. Has props, externalTypes, acceptsChildren.

kind

type "component"

externalTypes

External types whose properties are filtered out of props — the attribute bags a component forwards, such as HTMLButtonAttributes or SvelteHTMLElements['button'].

Covers every way props compose them: an intersection or union branch, a bare or indexed-access annotation, and interface Props extends Bag (directly or through a local base). Entries carry the written form with the same normalizations as TypeDeclarationJson.externalTypes: import renames at the definition site resolve to the exported name, and a type parameter bound inside the descent substitutes its written argument — interface A<T> extends HTMLAttributes<T> reached via `Props extends A<HTMLDivElement> records HTMLAttributes<HTMLDivElement>`. The component's *own* generics stay in scope and emit as written (HTMLAttributes<T> beside the genericParams documenting T). Each distinct bag appears once, in source order; a local name is used only when it hides a definition the walk cannot traverse (a mapped or conditional type). Names carry no module, so two distinct bags sharing an exported name collapse to one entry.

type string[]

see also

  • ``TypeDeclarationJson.externalTypes`` for the full entry contract, InterfaceDeclarationJson.externalTypes for the field on the props interface itself. Field shapes mirror TS syntax.

props

Svelte component props.

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

acceptsChildren

Whether the component accepts children (explicit children prop, inherited, or implicit template usage).

type boolean

alsoExportedFrom

Module paths (relative to sourceRoot) that re-export this declaration under the same name. The canonical declaration lives in this module's declarations array; these paths are additional import locations for the same thing.

The same edges appear from the re-exporting side as ModuleJson.reExports — use that when asking "what does this module re-export" instead of inverting these arrays. The two can disagree at the margins: a reExports entry whose canonical declaration is @nodocs (or whose module isn't in the analyzed set) has no back-link here.

Consumer note: To build a complete re-export map, scan two fields:

  1. alsoExportedFrom on each declaration — same-name re-exports
  2. aliasOf on declarations — renamed re-exports (separate declarations)

type string[]

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

lang?

Script language. undefined means TypeScript (default), 'js' for JavaScript-only components.

type "js"

aliasOf?

For renamed re-exports (export {foo as bar}), points to the original declaration. This declaration's name is the alias; aliasOf.name is the original name.

For renames out of the default slot (export {default as bar} from './x' where ./x is export default ...), aliasOf.name is 'default' — the canonical's actual symbol name. Consumers locate the canonical by (aliasOf.module, aliasOf.name).

Svelte component exception: when the source is a .svelte file (e.g., export {default as Foo} from './X.svelte'), the canonical's name is the component name (derived from the filename), so aliasOf.name is the component name ('X'), NOT 'default'. Consumers that branch on aliasOf.name === 'default' to detect default-rename should additionally check whether aliasOf.module ends with .svelte.

Different from alsoExportedFrom: aliases create new API surface names, while alsoExportedFrom tracks additional import paths for the same name.

type { module: string; name: string; }

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

ComponentPropJson
#

types.ts view source

also exported from index.ts

{ examples: string[]; seeAlso: string[]; throws: { description: string; type?: string | undefined; }[]; name: string; type: string; optional: boolean; bindable: boolean; deprecatedMessage?: string | undefined; ... 4 more ...; parameters?: { ...; }[] | undefined; } import {ComponentPropJson} from 'svelte-docinfo/types.js';

Component prop information for Svelte components.

Standalone schema (not extending ParameterJson) because component props have different semantics: named attributes with no positional order (<Foo {a} {b} /> = <Foo {b} {a} />), no rest parameters, and support for two-way binding via $bindable rune.

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

Prop name as declared in the component's $props() type.

type string

type

Resolved TypeScript type string.

type string

optional

Whether the prop is optional in the component's props type.

type boolean

bindable

Whether the prop uses the $bindable() rune, enabling two-way binding.

type boolean

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

typeInfo?

Structured type; absent when type is the whole story (see TypeJson).

type TypeJson

description?

Description from JSDoc on the prop's type declaration.

type string

defaultValue?

Default value expression from destructuring or @default tag.

type string

parameters?

Structured parameters for callable props (e.g., Snippet<[text: string]>).

Present when the prop has extractable parameters, absent otherwise. Only populated when there are actual parameters — bare Snippet / Snippet<[]> does not set this field. Intentionally .optional() rather than .default([]) (see the array-field policy note above): absence is a meaningful signal, not an empty list.

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

ComponentPropJsonInput
#

types.ts view source

{ name: string; type: string; examples?: string[] | undefined; deprecatedMessage?: string | undefined; seeAlso?: string[] | undefined; throws?: { description: string; type?: string | undefined; }[] | undefined; ... 6 more ...; parameters?: { ...; }[] | undefined; } import type {ComponentPropJsonInput} from 'svelte-docinfo/types.js';

name

Prop name as declared in the component's $props() type.

type string

type

Resolved TypeScript type string.

type string

examples?

Code examples from @example tags.

type string[]

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

seeAlso?

Related items from @see tags, in raw TSDoc format.

type string[]

throws?

Exceptions from @throws tags.

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

since?

Version introduced, from @since tag.

type string

typeInfo?

Structured type; absent when type is the whole story (see TypeJson).

type TypeJson

optional?

Whether the prop is optional in the component's props type.

type boolean

description?

Description from JSDoc on the prop's type declaration.

type string

defaultValue?

Default value expression from destructuring or @default tag.

type string

bindable?

Whether the prop uses the $bindable() rune, enabling two-way binding.

type boolean

parameters?

Structured parameters for callable props (e.g., Snippet<[text: string]>).

Present when the prop has extractable parameters, absent otherwise. Only populated when there are actual parameters — bare Snippet / Snippet<[]> does not set this field. Intentionally .optional() rather than .default([]) (see the array-field policy note above): absence is a meaningful signal, not an empty list.

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

ConstructorMemberJson
#

types.ts view source

also exported from index.ts

{ kind: "constructor"; name: "constructor" | "(construct)"; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 13 more ...; sourceLin... import {ConstructorMemberJson} from 'svelte-docinfo/types.js';

A constructor member (class constructor, construct signature). Has parameters, overloads — but not returnType/returnDescription (constructors always return their class).

name is narrowed to two literal sentinels: 'constructor' for class constructors and '(construct)' for interface/type-alias construct signatures (which share kind: 'constructor' but originate from getConstructSignatures() on a non-class type — no user-chosen identifier exists). The literal is preserved (rather than omitted) so getDisplayName and consumer renderers reading member.name keep working without a constructor-specific branch.

kind

type "constructor"

name

type "constructor" | "(construct)"

parameters

Function/method/constructor parameters.

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

overloads

Overload signatures (when there are multiple public overloads). Includes all public overloads. The implementation signature is excluded. Empty when there are no overloads (single signature).

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

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

DeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "function"; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 19 more ...; sourceLine?: number | undefined; } | ... 7 more .... import {DeclarationJson} from 'svelte-docinfo/types.js';

Metadata for an exported declaration (function, type, class, component, etc.).

Discriminated union on kind — each variant has only the fields relevant to that kind. Use isKind (in declaration-helpers.ts) to narrow, or check declaration.kind directly.

DeclarationJsonInput
#

types.ts view source

{ kind: "function"; name: string; returnType?: string | undefined; returnTypeInfo?: TypeJson | undefined; returnDescription?: string | undefined; parameters?: { name: string; ... 6 more ...; propertyDescriptions?: Record<...> | undefined; }[] | undefined; ... 15 more ...; genericParams?: { ...; }[] | undefined; } | ... import type {DeclarationJsonInput} from 'svelte-docinfo/types.js';

DeclarationKind
#

types.ts view source

also exported from index.ts

"function" | "type" | "variable" | "class" | "interface" | "enum" | "component" | "snippet" | "namespace" import {DeclarationKind} from 'svelte-docinfo/types.js';

The kind of top-level exported declaration.

Does not include 'constructor' — constructors only appear as MemberKind (nested in classes, interfaces, or types with construct signatures), never as top-level module exports.

DeclarationModifier
#

types.ts view source

also exported from index.ts

"public" | "protected" | "readonly" | "static" | "abstract" | "getter" | "setter" import {DeclarationModifier} from 'svelte-docinfo/types.js';

TypeScript modifier keywords extracted from declarations.

Only modifiers that appear on public API members are included. Private members (including #field syntax) are filtered out during analysis. Protected members are included as part of the extension API.

EnumDeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "enum"; members: ({ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 17 ... import {EnumDeclarationJson} from 'svelte-docinfo/types.js';

An enum declaration. Has members for enum values.

kind

type "enum"

members

Enum members: name/value pairs with optional JSDoc.

type ({ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 17 more ...; sourceLine?: nu...

alsoExportedFrom

Module paths (relative to sourceRoot) that re-export this declaration under the same name. The canonical declaration lives in this module's declarations array; these paths are additional import locations for the same thing.

The same edges appear from the re-exporting side as ModuleJson.reExports — use that when asking "what does this module re-export" instead of inverting these arrays. The two can disagree at the margins: a reExports entry whose canonical declaration is @nodocs (or whose module isn't in the analyzed set) has no back-link here.

Consumer note: To build a complete re-export map, scan two fields:

  1. alsoExportedFrom on each declaration — same-name re-exports
  2. aliasOf on declarations — renamed re-exports (separate declarations)

type string[]

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

aliasOf?

For renamed re-exports (export {foo as bar}), points to the original declaration. This declaration's name is the alias; aliasOf.name is the original name.

For renames out of the default slot (export {default as bar} from './x' where ./x is export default ...), aliasOf.name is 'default' — the canonical's actual symbol name. Consumers locate the canonical by (aliasOf.module, aliasOf.name).

Svelte component exception: when the source is a .svelte file (e.g., export {default as Foo} from './X.svelte'), the canonical's name is the component name (derived from the filename), so aliasOf.name is the component name ('X'), NOT 'default'. Consumers that branch on aliasOf.name === 'default' to detect default-rename should additionally check whether aliasOf.module ends with .svelte.

Different from alsoExportedFrom: aliases create new API surface names, while alsoExportedFrom tracks additional import paths for the same name.

type { module: string; name: string; }

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

ExternalReExportJson
#

types.ts view source

also exported from index.ts

{ name: string; specifier: string; typeOnly: boolean; originalName?: string | undefined; sourceLine?: number | undefined; } import {ExternalReExportJson} from 'svelte-docinfo/types.js';

A re-export whose immediate target is outside the analyzed source set — export {x} from 'pkg', export {x as y} from 'pkg', or export * as ns from 'pkg'.

specifier is the module specifier as written (usually a package name); there is no canonical declaration to resolve, so these entries are flat facts about the statement rather than edges into the module graph.

Only statements that *directly* reference the external specifier are captured. Forms that stay silent: import {x} from 'pkg'; export {x}; (import-then-export), re-export chains that reach a package through another source module (that module owns the entry), and specifiers the checker can't resolve. Statement-level @nodocs suppresses the entry.

name

Public exported name from this module.

type string

specifier

Module specifier as written in the statement (e.g. 'pkg').

type string

typeOnly

Whether the statement or specifier is type-only — see ReExportJson.typeOnly.

type boolean

originalName?

The name inside the external module when renamed (export {x as y} from 'pkg''x'). Omitted for same-name re-exports and namespace form (export * as ns).

type string

sourceLine?

1-based line of the export specifier in this module's source.

type number

ExternalReExportJsonInput
#

types.ts view source

{ name: string; specifier: string; originalName?: string | undefined; typeOnly?: boolean | undefined; sourceLine?: number | undefined; } import type {ExternalReExportJsonInput} from 'svelte-docinfo/types.js';

name

Public exported name from this module.

type string

specifier

Module specifier as written in the statement (e.g. 'pkg').

type string

originalName?

The name inside the external module when renamed (export {x as y} from 'pkg''x'). Omitted for same-name re-exports and namespace form (export * as ns).

type string

typeOnly?

Whether the statement or specifier is type-only — see ReExportJson.typeOnly.

type boolean

sourceLine?

1-based line of the export specifier in this module's source.

type number

FunctionDeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "function"; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 19 more ...; sourceLine?: number | undefined; } import {FunctionDeclarationJson} from 'svelte-docinfo/types.js';

A function declaration. Has parameters, returnType, returnDescription, overloads.

kind

type "function"

parameters

Function/method/constructor parameters.

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

overloads

Overload signatures (when there are multiple public overloads). Includes all public overloads. The implementation signature is excluded. Empty when there are no overloads (single signature).

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

alsoExportedFrom

Module paths (relative to sourceRoot) that re-export this declaration under the same name. The canonical declaration lives in this module's declarations array; these paths are additional import locations for the same thing.

The same edges appear from the re-exporting side as ModuleJson.reExports — use that when asking "what does this module re-export" instead of inverting these arrays. The two can disagree at the margins: a reExports entry whose canonical declaration is @nodocs (or whose module isn't in the analyzed set) has no back-link here.

Consumer note: To build a complete re-export map, scan two fields:

  1. alsoExportedFrom on each declaration — same-name re-exports
  2. aliasOf on declarations — renamed re-exports (separate declarations)

type string[]

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

returnType?

Function/method return type.

type string

returnTypeInfo?

Structured return type; absent when returnType is the whole story (see TypeJson).

type TypeJson

returnDescription?

Return value description from @returns tag.

type string

aliasOf?

For renamed re-exports (export {foo as bar}), points to the original declaration. This declaration's name is the alias; aliasOf.name is the original name.

For renames out of the default slot (export {default as bar} from './x' where ./x is export default ...), aliasOf.name is 'default' — the canonical's actual symbol name. Consumers locate the canonical by (aliasOf.module, aliasOf.name).

Svelte component exception: when the source is a .svelte file (e.g., export {default as Foo} from './X.svelte'), the canonical's name is the component name (derived from the filename), so aliasOf.name is the component name ('X'), NOT 'default'. Consumers that branch on aliasOf.name === 'default' to detect default-rename should additionally check whether aliasOf.module ends with .svelte.

Different from alsoExportedFrom: aliases create new API surface names, while alsoExportedFrom tracks additional import paths for the same name.

type { module: string; name: string; }

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

FunctionMemberJson
#

types.ts view source

also exported from index.ts

{ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 17 more ...; sourceLine?: num... import {FunctionMemberJson} from 'svelte-docinfo/types.js';

A function member (method, call signature, method signature). Has parameters, returnType, returnDescription, overloads.

optional reflects a ? token on the declaration (e.g., foo?(): void on an interface or type literal). Always false for index/call/construct signatures and for class methods (TypeScript disallows optional methods on classes).

name is the user-chosen method/property identifier, except for call signatures on interfaces and type aliases where it is the literal sentinel '(call)'.

kind

type "function"

name

User-chosen identifier, or the literal '(call)' sentinel for unnamed call signatures.

type string

optional

Whether the member has a ? token in its declaration.

type boolean

parameters

Function/method/constructor parameters.

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

overloads

Overload signatures (when there are multiple public overloads). Includes all public overloads. The implementation signature is excluded. Empty when there are no overloads (single signature).

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

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

defaultValue?

Default value documented via @default — for a callable member, typically the behavior used when the callback is omitted. Always tag-authored (structural containers have no initializers). Members only: top-level function declarations and overloads never carry one.

type string

returnType?

Function/method return type.

type string

returnTypeInfo?

Structured return type; absent when returnType is the whole story (see TypeJson).

type TypeJson

returnDescription?

Return value description from @returns tag.

type string

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

GenericParamJson
#

types.ts view source

also exported from index.ts

{ name: string; constraint?: string | undefined; defaultType?: string | undefined; } import {GenericParamJson} from 'svelte-docinfo/types.js';

Generic type parameter metadata extracted from declarations like <T extends string = unknown>.

Present on functions, classes, interfaces, type aliases, and Svelte components that declare generic type parameters.

name

Parameter name like T.

type string

constraint?

Constraint like string from T extends string.

type string

defaultType?

Default type like unknown from T = unknown.

type string

InterfaceDeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "interface"; extends: string[]; externalTypes: string[]; members: ({ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDes... import {InterfaceDeclarationJson} from 'svelte-docinfo/types.js';

An interface declaration. Has members, extends.

kind

type "interface"

extends

Extended interfaces.

Verbatim text of this declaration's own heritage clause, so entries are spelled as this module wrote them and resolve in its scope — a local rename (import type {Bag as B}) stays B. Unlike externalTypes, whose walk crosses modules and therefore resolves renames back to the exported name, this clause never leaves the declaring file.

type string[]

see also

  • ``ClassDeclarationJson.extends, ClassDeclarationJson.implements for the other verbatim heritage fields, externalTypes (this variant) for the resolved external reach.

externalTypes

External types the heritage composition reaches whose contributions members never enumerates.

Interface members are own-only, so nothing is *filtered* — inherited content simply isn't listed. This field names the external types behind that absence: interface Props extends HTMLButtonAttributes records the bag directly, and interface Props extends LocalBase (where LocalBase reaches a bag) records it transitively — the same answer the component annotated with this interface gets, where extends alone dead-ends at a possibly-unexported local name. Inherited *local* content is the extends field's business: the base is documented at its own declaration.

Entry normalization (rename resolution, type-parameter substitution, text-dedupe, source order) matches TypeDeclarationJson.externalTypes.

type string[]

members

Interface members: property signatures, method signatures, index signatures, call/construct signatures — own members only, inherited members excluded whatever their origin (call/construct signatures included: a base interface's (call) is not enumerated here).

type ({ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 17 more ...; sourceLine?: nu...

mergedValue

The exported name also carries a value meaning — a merged value+type symbol (const Foo = ... + interface Foo {...}), where the interface wins the declaration slot and the value's own type goes undocumented. Tells consumers the name is importable as a runtime value: `import {Foo}, never import type {Foo} (see generateImport`).

type boolean

see also

  • ``TypeDeclarationJson.mergedValue``

alsoExportedFrom

Module paths (relative to sourceRoot) that re-export this declaration under the same name. The canonical declaration lives in this module's declarations array; these paths are additional import locations for the same thing.

The same edges appear from the re-exporting side as ModuleJson.reExports — use that when asking "what does this module re-export" instead of inverting these arrays. The two can disagree at the margins: a reExports entry whose canonical declaration is @nodocs (or whose module isn't in the analyzed set) has no back-link here.

Consumer note: To build a complete re-export map, scan two fields:

  1. alsoExportedFrom on each declaration — same-name re-exports
  2. aliasOf on declarations — renamed re-exports (separate declarations)

type string[]

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

aliasOf?

For renamed re-exports (export {foo as bar}), points to the original declaration. This declaration's name is the alias; aliasOf.name is the original name.

For renames out of the default slot (export {default as bar} from './x' where ./x is export default ...), aliasOf.name is 'default' — the canonical's actual symbol name. Consumers locate the canonical by (aliasOf.module, aliasOf.name).

Svelte component exception: when the source is a .svelte file (e.g., export {default as Foo} from './X.svelte'), the canonical's name is the component name (derived from the filename), so aliasOf.name is the component name ('X'), NOT 'default'. Consumers that branch on aliasOf.name === 'default' to detect default-rename should additionally check whether aliasOf.module ends with .svelte.

Different from alsoExportedFrom: aliases create new API surface names, while alsoExportedFrom tracks additional import paths for the same name.

type { module: string; name: string; }

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

MemberJson
#

types.ts view source

also exported from index.ts

{ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 17 more ...; sourceLine?: num... import {MemberJson} from 'svelte-docinfo/types.js';

Metadata for a nested declaration within a class, interface, type, or enum.

Discriminated union on kind with 3 variants: FunctionMemberJson, VariableMemberJson, ConstructorMemberJson. Use isKind (in declaration-helpers.ts) to narrow, or check member.kind directly.

Does not include fields that exist on declarations but not on members (extends, externalTypes, implements, props, alsoExportedFrom, aliasOf).

Nesting is exactly one level deep — members never contain their own members.

MemberJsonInput
#

types.ts view source

{ kind: "function"; name: string; optional?: boolean | undefined; defaultValue?: string | undefined; returnType?: string | undefined; returnTypeInfo?: TypeJson | undefined; ... 15 more ...; genericParams?: { ...; }[] | undefined; } | { ...; } | { ...; } import type {MemberJsonInput} from 'svelte-docinfo/types.js';

MemberKind
#

types.ts view source

also exported from index.ts

"function" | "variable" | "constructor" import {MemberKind} from 'svelte-docinfo/types.js';

The subset of declaration kinds that appear as nested members in classes, interfaces, and types.

Class members include constructors ('constructor'), methods ('function'), and properties/accessors ('variable'). Interface/type properties use the same kinds for property signatures, method signatures, index signatures, and call/construct signatures.

Top-level-only kinds ('class', 'interface', 'type', 'enum', 'component') never appear as members — nesting is exactly one level deep.

ModuleJson
#

types.ts view source

also exported from index.ts

{ path: string; declarations: ({ kind: "function"; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 19 more ...; sourceLine?: numbe... import {ModuleJson} from 'svelte-docinfo/types.js';

Metadata for a source module — the top-level container in the data model.

analyze and analyzeFromFiles return Array<ModuleJson> sorted alphabetically by path. Each module contains its exported declarations, dependency graph, and optional moduleComment.

path

Path relative to sourceRoot (e.g., helpers.ts for the default SvelteKit src/lib layout). sourceRoot is configurable via createSourceOptions / the CLI --source-root flag — consumers with a custom layout (e.g., sourcePaths: ['src/lib', 'src/routes'], sourceRoot: 'src') see prefixes like lib/foo.ts here.

type string

declarations

Exported declarations from this module.

type ({ kind: "function"; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 19 more ...; sourceLine?: number | undefined; } | ... 7 more ...

dependencies

Modules this imports (paths relative to sourceRoot).

type string[]

dependents

Modules that import this (paths relative to sourceRoot).

type string[]

starExports

Modules fully re-exported via export * from './module'. Paths are relative to sourceRoot. Statement-level @nodocs suppresses the entry, like the other re-export encodings.

type string[]

reExports

Same-name re-exports in this module's source, sorted by name then module (names can collide — see ReExportJson). The forward view of alsoExportedFrom — see ReExportJson for the full contract (canonical resolution, Svelte default-slot naming, @nodocs suppression, presence caveats).

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

externalReExports

Re-exports whose immediate target is an external package, sorted by name then specifier. See ExternalReExportJson for which forms are captured.

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

externalStarExports

External modules fully re-exported via export * from 'pkg', as written (statement order). The projected names are unknown — the package isn't analyzed. Statement-level @nodocs suppresses the entry; unresolvable specifiers are skipped.

type string[]

partial

Whether the module is a placeholder for a file that couldn't be analyzed.

Currently only set for Svelte files where svelte2tsx threw at ingest (the transform_failed diagnostic carries the error). Placeholder modules have declarations: [] and serve as a structural slot so the modules array reflects the full owned set; consumers render them as "broken" entries.

type boolean

moduleComment?

File-level JSDoc comment (from @module tag).

type string

ModuleJsonInput
#

types.ts view source

{ path: string; declarations?: ({ kind: "function"; name: string; returnType?: string | undefined; returnTypeInfo?: TypeJson | undefined; returnDescription?: string | undefined; ... 16 more ...; genericParams?: { ...; }[] | undefined; } | ... 7 more ... | { ...; })[] | undefined; ... 7 more ...; partial?: boolean | ... import type {ModuleJsonInput} from 'svelte-docinfo/types.js';

path

Path relative to sourceRoot (e.g., helpers.ts for the default SvelteKit src/lib layout). sourceRoot is configurable via createSourceOptions / the CLI --source-root flag — consumers with a custom layout (e.g., sourcePaths: ['src/lib', 'src/routes'], sourceRoot: 'src') see prefixes like lib/foo.ts here.

type string

declarations?

Exported declarations from this module.

type ({ kind: "function"; name: string; returnType?: string | undefined; returnTypeInfo?: TypeJson | undefined; returnDescription?: string | undefined; parameters?: { name: string; ... 6 more ...; propertyDescriptions?: Record<...> | undefined; }[] | undefined; ... 15 more ...; genericParams?: { ...; }[] | undefined; } |...

moduleComment?

File-level JSDoc comment (from @module tag).

type string

dependencies?

Modules this imports (paths relative to sourceRoot).

type string[]

dependents?

Modules that import this (paths relative to sourceRoot).

type string[]

starExports?

Modules fully re-exported via export * from './module'. Paths are relative to sourceRoot. Statement-level @nodocs suppresses the entry, like the other re-export encodings.

type string[]

reExports?

Same-name re-exports in this module's source, sorted by name then module (names can collide — see ReExportJson). The forward view of alsoExportedFrom — see ReExportJson for the full contract (canonical resolution, Svelte default-slot naming, @nodocs suppression, presence caveats).

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

externalReExports?

Re-exports whose immediate target is an external package, sorted by name then specifier. See ExternalReExportJson for which forms are captured.

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

externalStarExports?

External modules fully re-exported via export * from 'pkg', as written (statement order). The projected names are unknown — the package isn't analyzed. Statement-level @nodocs suppresses the entry; unresolvable specifiers are skipped.

type string[]

partial?

Whether the module is a placeholder for a file that couldn't be analyzed.

Currently only set for Svelte files where svelte2tsx threw at ingest (the transform_failed diagnostic carries the error). Placeholder modules have declarations: [] and serve as a structural slot so the modules array reflects the full owned set; consumers render them as "broken" entries.

type boolean

NamespaceDeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "namespace"; module: string; alsoExportedFrom: string[]; partial: boolean; examples: string[]; seeAlso: string[]; throws: { description: string; type?: string | undefined; }[]; name: string; modifiers: ("public" | ... 5 more ... | "setter")[]; ... 8 more ...; sourceLine?: number | undefined; } import {NamespaceDeclarationJson} from 'svelte-docinfo/types.js';

A namespace re-export binding: export * as ns from './x'.

Carries no inline members — module points to the source module whose declarations are projected under this name. Consumers that want to render ns.a can deref by reading the source module's declarations array.

kind

type "namespace"

module

Source module path (relative to sourceRoot) projected under this binding.

type string

alsoExportedFrom

Module paths (relative to sourceRoot) that re-export this declaration under the same name. The canonical declaration lives in this module's declarations array; these paths are additional import locations for the same thing.

The same edges appear from the re-exporting side as ModuleJson.reExports — use that when asking "what does this module re-export" instead of inverting these arrays. The two can disagree at the margins: a reExports entry whose canonical declaration is @nodocs (or whose module isn't in the analyzed set) has no back-link here.

Consumer note: To build a complete re-export map, scan two fields:

  1. alsoExportedFrom on each declaration — same-name re-exports
  2. aliasOf on declarations — renamed re-exports (separate declarations)

type string[]

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

aliasOf?

For renamed re-exports (export {foo as bar}), points to the original declaration. This declaration's name is the alias; aliasOf.name is the original name.

For renames out of the default slot (export {default as bar} from './x' where ./x is export default ...), aliasOf.name is 'default' — the canonical's actual symbol name. Consumers locate the canonical by (aliasOf.module, aliasOf.name).

Svelte component exception: when the source is a .svelte file (e.g., export {default as Foo} from './X.svelte'), the canonical's name is the component name (derived from the filename), so aliasOf.name is the component name ('X'), NOT 'default'. Consumers that branch on aliasOf.name === 'default' to detect default-rename should additionally check whether aliasOf.module ends with .svelte.

Different from alsoExportedFrom: aliases create new API surface names, while alsoExportedFrom tracks additional import paths for the same name.

type { module: string; name: string; }

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

OverloadJson
#

types.ts view source

also exported from index.ts

{ typeSignature: string; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 4 more ...; returnDescription?: string | undefined; } import {OverloadJson} from 'svelte-docinfo/types.js';

A single function overload signature.

When a function has multiple overload signatures, each public overload is captured here. The implementation signature is excluded.

typeSignature

Full TypeScript type signature for this overload.

type string

parameters

Parameters for this overload.

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

genericParams

Generic type parameters for this overload.

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

returnType?

Return type for this overload.

type string

returnTypeInfo?

Structured return type; absent when returnType is the whole story (see TypeJson).

type TypeJson

docComment?

JSDoc/TSDoc comment specific to this overload.

type string

returnDescription?

Return value description from @returns tag on this overload.

type string

OverloadJsonInput
#

types.ts view source

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

typeSignature

Full TypeScript type signature for this overload.

type string

parameters?

Parameters for this overload.

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

returnType?

Return type for this overload.

type string

returnTypeInfo?

Structured return type; absent when returnType is the whole story (see TypeJson).

type TypeJson

genericParams?

Generic type parameters for this overload.

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

docComment?

JSDoc/TSDoc comment specific to this overload.

type string

returnDescription?

Return value description from @returns tag on this overload.

type string

ParameterJson
#

types.ts view source

also exported from index.ts

{ name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; } import {ParameterJson} from 'svelte-docinfo/types.js';

Parameter information for functions and methods.

Kept distinct from ComponentPropJson despite structural similarity. Function parameters form a tuple with positional semantics: calling order matters (fn(a, b) vs fn(b, a)), may include rest parameters and destructuring patterns.

name

Parameter name (e.g., options, ...args).

type string

type

Resolved TypeScript type string (e.g., string, Record<string, unknown>).

type string

optional

Whether the parameter has a ? token.

type boolean

rest

Whether the parameter uses rest syntax (...args).

type boolean

typeInfo?

Structured type; absent when type is the whole story (see TypeJson).

type TypeJson

description?

Description from @param tag.

type string

defaultValue?

Default value expression from the source (e.g., 'hello', 42).

type string

propertyDescriptions?

Descriptions for properties of a named object parameter, from dotted @param tags (@param obj.prop - ...).

Keyed by the sub-path relative to this parameter — @param obj.prop becomes {prop: '...'}, @param obj.a.b becomes {'a.b': '...'}. Keys are unvalidated against the parameter's actual type (matching the @mutates philosophy); absent when no dotted @param tags reference this parameter. Only populated for function/method/constructor signature parameters.

Matching is by the parameter's name, so destructured parameters (fn({a, b}: T)) are not covered — TypeScript names them __0, with no author-facing identifier for a @param key to reference.

type Record<string, string>

ParameterJsonInput
#

types.ts view source

{ name: string; type: string; typeInfo?: TypeJson | undefined; optional?: boolean | undefined; rest?: boolean | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; } import type {ParameterJsonInput} from 'svelte-docinfo/types.js';

name

Parameter name (e.g., options, ...args).

type string

type

Resolved TypeScript type string (e.g., string, Record<string, unknown>).

type string

typeInfo?

Structured type; absent when type is the whole story (see TypeJson).

type TypeJson

optional?

Whether the parameter has a ? token.

type boolean

rest?

Whether the parameter uses rest syntax (...args).

type boolean

description?

Description from @param tag.

type string

defaultValue?

Default value expression from the source (e.g., 'hello', 42).

type string

propertyDescriptions?

Descriptions for properties of a named object parameter, from dotted @param tags (@param obj.prop - ...).

Keyed by the sub-path relative to this parameter — @param obj.prop becomes {prop: '...'}, @param obj.a.b becomes {'a.b': '...'}. Keys are unvalidated against the parameter's actual type (matching the @mutates philosophy); absent when no dotted @param tags reference this parameter. Only populated for function/method/constructor signature parameters.

Matching is by the parameter's name, so destructured parameters (fn({a, b}: T)) are not covered — TypeScript names them __0, with no author-facing identifier for a @param key to reference.

type Record<string, string>

Reactivity
#

types.ts view source

also exported from index.ts

"$state" | "$state.raw" | "$derived" | "$derived.by" import {Reactivity} from 'svelte-docinfo/types.js';

Reactivity flavor for a variable declaration or class field, captured from the rune call at the initializer (e.g., let count = $state(0)).

Only the value-producing reactivity runes are represented here — $props and $bindable are modeled separately as ComponentPropJson.bindable (and prop-presence on the props array). A renderer wanting "all rune annotations across declarations and props" needs to read both this field and ComponentPropJson.bindable.

  • $state — deeply reactive proxy
  • $state.raw — reference-only reactive (no proxy)
  • $derived — recomputed from dependencies (re-assignable)
  • $derived.by — same as $derived, with a function argument

Detection is syntactic (AST-based) and runs on every analyzed file regardless of extension. Most reactive declarations live in .svelte, .svelte.ts, or .svelte.js, but the field will also surface on any .ts/.js file that uses the same rune call patterns — by design, so documentation pipelines can capture any rune-shaped declaration their conventions choose to expose.

ReExportJson
#

types.ts view source

also exported from index.ts

{ name: string; module: string; typeOnly: boolean; sourceLine?: number | undefined; } import {ReExportJson} from 'svelte-docinfo/types.js';

A same-name re-export edge, from the re-exporting module's side.

Each entry on ModuleJson.reExports records that the module's source contains export {name} from ... where the canonical declaration lives in module. This is the forward view of the same fact that alsoExportedFrom records on the canonical declaration — consumers resolve the canonical by (module, name), the same lookup contract as aliasOf.

Same-name re-exports of analyzed source only. Renamed re-exports appear as declarations with aliasOf in the re-exporting module; star exports live in ModuleJson.starExports; external re-exports in ModuleJson.externalReExports / externalStarExports. Use resolveExportSurface (in postprocess.ts) to combine all of these into a module's full export surface — it handles the name dedup (a documented same-name re-export appears both here and as a synthesized alias declaration) and the ES star semantics (explicit exports shadow star-projected ones, names ambiguous between stars are excluded, default doesn't project).

module points at the *canonical* module (multi-hop chains are resolved), not the immediate specifier in the export statement. For Svelte default-slot re-exports (export {default} from './X.svelte'), name is the component name derived from the filename ('X'), matching the canonical declaration's name — the same exception documented on aliasOf. Because of that re-keying, two entries in one module can share a name (a re-keyed component colliding with a same-name re-export from another module); (module, name) pairs remain unique (exact duplicates are deduped at construction).

@nodocs on the export statement suppresses the entry (and the alsoExportedFrom back-link). When the canonical declaration itself is @nodocs, or the canonical module isn't part of the analyzed set, the entry still exists but has no matching back-link — the same presence caveat as aliasOf.module and starExports.

name

Exported name — the canonical declaration's name in module.

type string

module

Module path (relative to sourceRoot) where the canonical declaration lives.

type string

typeOnly

Whether the statement (export type {A} from ...) or specifier (export {type A} from ...) is type-only — the name is erased at runtime and importable only via import type.

type boolean

sourceLine?

1-based line of the export specifier in this module's source. When identical (name, module) edges are deduped (Svelte default-slot re-keying), the smallest line is kept.

type number

ReExportJsonInput
#

types.ts view source

{ name: string; module: string; typeOnly?: boolean | undefined; sourceLine?: number | undefined; } import type {ReExportJsonInput} from 'svelte-docinfo/types.js';

name

Exported name — the canonical declaration's name in module.

type string

module

Module path (relative to sourceRoot) where the canonical declaration lives.

type string

typeOnly?

Whether the statement (export type {A} from ...) or specifier (export {type A} from ...) is type-only — the name is erased at runtime and importable only via import type.

type boolean

sourceLine?

1-based line of the export specifier in this module's source. When identical (name, module) edges are deduped (Svelte default-slot re-keying), the smallest line is kept.

type number

SnippetDeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "snippet"; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 15 more ...; sourceLine?: number | undefined; } import {SnippetDeclarationJson} from 'svelte-docinfo/types.js';

A Svelte snippet declaration exported from <script module>. Has parameters.

kind

type "snippet"

parameters

Snippet parameters.

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

alsoExportedFrom

Module paths (relative to sourceRoot) that re-export this declaration under the same name. The canonical declaration lives in this module's declarations array; these paths are additional import locations for the same thing.

The same edges appear from the re-exporting side as ModuleJson.reExports — use that when asking "what does this module re-export" instead of inverting these arrays. The two can disagree at the margins: a reExports entry whose canonical declaration is @nodocs (or whose module isn't in the analyzed set) has no back-link here.

Consumer note: To build a complete re-export map, scan two fields:

  1. alsoExportedFrom on each declaration — same-name re-exports
  2. aliasOf on declarations — renamed re-exports (separate declarations)

type string[]

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

aliasOf?

For renamed re-exports (export {foo as bar}), points to the original declaration. This declaration's name is the alias; aliasOf.name is the original name.

For renames out of the default slot (export {default as bar} from './x' where ./x is export default ...), aliasOf.name is 'default' — the canonical's actual symbol name. Consumers locate the canonical by (aliasOf.module, aliasOf.name).

Svelte component exception: when the source is a .svelte file (e.g., export {default as Foo} from './X.svelte'), the canonical's name is the component name (derived from the filename), so aliasOf.name is the component name ('X'), NOT 'default'. Consumers that branch on aliasOf.name === 'default' to detect default-rename should additionally check whether aliasOf.module ends with .svelte.

Different from alsoExportedFrom: aliases create new API surface names, while alsoExportedFrom tracks additional import paths for the same name.

type { module: string; name: string; }

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

TupleElementJson
#

types.ts view source

also exported from index.ts

TupleElementJson import {TupleElementJson} from 'svelte-docinfo/types.js';

One element of a {kind: 'tuple'} node.

optional and rest are emitted only when true, matching the tree's meaningful-absence optionality (unlike ParameterJson's defaulted booleans, so the recursive schema keeps input = output).

name?

The written label of a named tuple member ([a: string]).

type string

type

The element's type. An optional element's type has the widening undefined stripped so optional carries it alone; a rest element's is the array it collects (...rest: boolean[] carries an array node over boolean, matching the written form), while a variadic spread of an unresolved type (...T) carries the spread type itself.

type TypeJson

optional?

The element's ? marker; emitted only when true.

type boolean

rest?

The element's ... marker; emitted only when true.

type boolean

TypeDeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "type"; externalTypes: string[]; members: ({ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> ... import {TypeDeclarationJson} from 'svelte-docinfo/types.js';

A type alias declaration. Has members, externalTypes.

kind

type "type"

externalTypes

External types whose contributions are filtered out of members.

Filtering is by declaration origin at every granularity — named properties, index signatures, call/construct signatures — so a purely structural external branch (an index-signature-only or callable-only interface) is recorded here exactly like a named-property bag. A declaration-less contribution (the index signature the checker synthesizes for a mapped-type instantiation like Record<string, X> or Partial<Indexed>) is kept in members and records nothing here.

Covers every composition the written type reaches: an intersection or union branch, a bare or indexed-access reference, and a type composed behind a project-local name (type Base = Bag & {…}, a local interface's extends, a local container's accessed property LocalMap['a']). Entries carry the written form with two normalizations: an identifier bound by an import rename at the definition site (import type {Bag as B}) resolves back to the name its module exports, and a type parameter bound inside the descent substitutes its written argument (interface A<T> extends ExtG<T> reached via extends A<string> records ExtG<string>). Each distinct contributor appears once, in source order; a generic reference keeps its arguments. A local name is used only when it hides a definition the walk cannot traverse — a mapped or conditional type.

Names carry no module, so the dedupe is by name alone: two *distinct* external types sharing an exported name (one from each of two packages) collapse to a single entry.

type string[]

see also

  • ``ComponentDeclarationJson.externalTypes, InterfaceDeclarationJson.externalTypes, ClassDeclarationJson.externalTypes for the same field on the other kinds, and ClassDeclarationJson.extends, ClassDeclarationJson.implements, InterfaceDeclarationJson.extends for the verbatim own-clause heritage fields. Field shapes mirror TS syntax.

members

Type members: property signatures, method signatures, index signatures, call/construct signatures.

type ({ kind: "function"; name: string; optional: boolean; parameters: { name: string; type: string; optional: boolean; rest: boolean; typeInfo?: TypeJson | undefined; description?: string | undefined; defaultValue?: string | undefined; propertyDescriptions?: Record<...> | undefined; }[]; ... 17 more ...; sourceLine?: nu...

mergedValue

The exported name also carries a value meaning — a merged value+type symbol (const Foo = z.strictObject({...}) + `type Foo = z.infer<typeof Foo>`, the schema/type pattern), where the type alias wins the declaration slot and the value's own type goes undocumented. Tells consumers the name is importable as a runtime value: import {Foo}, never import type {Foo} (see generateImport).

type boolean

see also

  • ``InterfaceDeclarationJson.mergedValue``

alsoExportedFrom

Module paths (relative to sourceRoot) that re-export this declaration under the same name. The canonical declaration lives in this module's declarations array; these paths are additional import locations for the same thing.

The same edges appear from the re-exporting side as ModuleJson.reExports — use that when asking "what does this module re-export" instead of inverting these arrays. The two can disagree at the margins: a reExports entry whose canonical declaration is @nodocs (or whose module isn't in the analyzed set) has no back-link here.

Consumer note: To build a complete re-export map, scan two fields:

  1. alsoExportedFrom on each declaration — same-name re-exports
  2. aliasOf on declarations — renamed re-exports (separate declarations)

type string[]

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

typeInfo?

Structured type; absent when typeSignature is the whole story (see TypeJson). The headline case: a union alias's typeSignature prints as its own name (ColorScheme), and this field carries the enumerable members. Type aliases print as their own name for every non-interned type, so the tree is emitted there whatever its shape — the exception is object and function roots, whose content members already carries.

type TypeJson

aliasOf?

For renamed re-exports (export {foo as bar}), points to the original declaration. This declaration's name is the alias; aliasOf.name is the original name.

For renames out of the default slot (export {default as bar} from './x' where ./x is export default ...), aliasOf.name is 'default' — the canonical's actual symbol name. Consumers locate the canonical by (aliasOf.module, aliasOf.name).

Svelte component exception: when the source is a .svelte file (e.g., export {default as Foo} from './X.svelte'), the canonical's name is the component name (derived from the filename), so aliasOf.name is the component name ('X'), NOT 'default'. Consumers that branch on aliasOf.name === 'default' to detect default-rename should additionally check whether aliasOf.module ends with .svelte.

Different from alsoExportedFrom: aliases create new API surface names, while alsoExportedFrom tracks additional import paths for the same name.

type { module: string; name: string; }

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

TypeJson
#

types.ts view source

also exported from index.ts

TypeJson import {TypeJson} from 'svelte-docinfo/types.js';

Structured type information — the machine-readable counterpart to the flat type strings (ParameterJson.type, ComponentPropJson.type, and the typeSignature fields that carry a typeInfo sibling).

Absence contract: the field holding a TypeJson is absent when the flat string is the whole story — the type is terminal at the root (an intrinsic, a plain object literal, a function type, a bare named reference). Present only when the node carries structure the string can't: union/intersection members, reference type arguments, enumerable literals; an array or tuple qualifies when an element does (readonly alone doesn't — the flat string carries it, except at alias roots where the relaxation emits the tree regardless). A reference over the *empty* tuple is the one instantiation that doesn't qualify: Snippet<[]> prints itself in full, so the tree would wrap nothing (Snippet<[a: string]> still qualifies — its tuple has elements). Nested nodes inside a present tree are always populated (they have no flat-string sibling).

One exception, on TypeDeclarationJson for type aliases: the checker prints an aliased type as its bare alias name, so type StrArr = string[] has typeSignature: "StrArr" — no flat sibling to defer to. There the tree is emitted whatever its shape, except for object and function roots, whose content the declaration's own members already carries. Interned types (intrinsics, literals) don't carry an alias symbol and print structurally, so type Str = string is still absent.

Expansion policy: unions and intersections recurse into members; named references keep name plus recursive typeArgs; arrays carry their element; tuples carry elements (label, ?/... markers, recursive type); both mark readonly when written so (readonly Tome[], ReadonlyArray<Tome>, readonly [a, b]). Everything else is terminal: object literals, function types, and unclassified types (type parameters, conditional types, module objects) carry only text. Object property maps are deliberately not expanded. Recursion is depth-capped; nodes past the cap degrade to {kind: 'other', text}.

Alias policy: alias is emitted whenever the checker reports an alias symbol, root or nested — for a root node it may duplicate the flat string (type: "ColorScheme" beside alias: "ColorScheme"), which is accepted for uniformity: nested nodes have no flat sibling, and consumers get one lookup key (alias on composites, name on references) at any depth. This covers the composite kinds only. An aliased object type becomes a reference under its alias name.

Callable classification: callability is the load-bearing renderer signal, so anything with a call signature is a function node — with one narrow exception: a *named generic instantiation* (checker Reference-flagged, symbol-named, carrying type arguments) classifies as a reference even when callable, so Snippet<[a: string]> is a reference whose tuple typeArg carries real elements, and an alias over one, nested, references by the alias name (type MySnippet = Snippet<[string]> in a union is {kind: 'reference', name: 'MySnippet'}; at its own declaration root the self-alias skip applies and the Snippet reference shows through). Bare signatures (() => void), aliased function types, and anonymous or hybrid callables — non-generic callable interfaces included — stay function, so their name survives only inside text (type Handler = (e: Event) => void nested in a union is {kind: 'function', text: 'Handler'}, which a whole-string type-link lookup still resolves, but a structural walk can't distinguish from a printed signature).

Normalization: mirrors the flat strings — the optional-widening undefined member is dropped from a root union (optional: true carries it, and an optional tuple element strips the same widening from its type), and a true | false literal pair collapses to the boolean intrinsic (the checker expands boolean inside unions). A union reduced to one member by either rule becomes that member directly, never a 1-member union.

Terminal text fields are printed with NoTruncation up to a 1000-char budget, past which the checker's own elided rendering is used — so text is always a well-formed type string, and one node can't grow without bound the way the depth cap prevents for the tree. The flat strings keep the checker's default ~160-char truncation throughout (they are the checker's canonical rendering; see getTypeSignature). The budget bites only on types whose alias TypeScript dropped — an alias over an indexed access or conditional (z.infer<typeof S>, valibot's InferOutput) carries no alias symbol, so the checker expands its whole structure at every use.

Written-name recovery: where a written annotation exists (return types — per overload included — parameters, variables, type-alias declarations and their properties, index signatures, getter-backed accessors, component props, snippet parameters), each bare type reference in it is resolved by checker type identity, and a type the checker has no name for — the alias-dropped shapes above — emits {kind: 'reference', name} instead of expanding, alias-lost unions and intersections included. The name resolves through import aliases to the importable one (import {Original as Renamed} recovers Original); a name the checker has is never overridden; typeof queries, import types, inline type literals, and argument-carrying references (z.infer<typeof S> itself, Extract<D, {kind: K}> — whose bare symbol name would misrepresent the instantiation) never recover. A recovered bare reference is emitted even at the root, relaxing the absence contract the way alias roots do: a checker-named bare reference defers to a flat sibling printing the same name, while a recovered one stands against the anonymous expansion, so the name exists only in the tree.

Registry recovery: behind the written channel, unannotated positions recover through the analyzed set's alias registry — any exported, non-@nodocs, non-generic lost alias of an emitted module, matched by checker type identity. A registry-recovered reference additionally carries module, the declaring module's ModuleJson.path — provenance for collision-exact linking, and always an emitted module (gated modules never register), so a consumer lookup by (module, name) can't dangle. module is registry-only, deliberately: a written-channel recovery names whatever the author wrote at the site (which may not be the registry's winner), and checker-named references never carry it — consumers must handle absence.

Member order and nested aliases: union members follow the flat string's printed order — null/undefined sink last, and the checker's origin (the same internal field the flat strings are printed from) lists plain members before named sub-unions, so written ColorScheme | number reads number | ColorScheme in both — and a member written as a named sub-union survives as its own alias-carrying union node (ColorScheme stays nested, not flattened literals). When no usable origin exists the walk degrades, bounded, to the checker's normalized list: flattened members in checker-internal order (nullish still sunk last), written sub-aliases lost.

VariableDeclarationJson
#

types.ts view source

also exported from index.ts

{ kind: "variable"; alsoExportedFrom: string[]; partial: boolean; examples: string[]; seeAlso: string[]; throws: { description: string; type?: string | undefined; }[]; name: string; modifiers: ("public" | ... 5 more ... | "setter")[]; ... 11 more ...; sourceLine?: number | undefined; } import {VariableDeclarationJson} from 'svelte-docinfo/types.js';

A variable declaration. Has optional reactivity for top-level rune-module exports (e.g., export let count = $state(0) in .svelte.ts or <script module>).

kind

type "variable"

alsoExportedFrom

Module paths (relative to sourceRoot) that re-export this declaration under the same name. The canonical declaration lives in this module's declarations array; these paths are additional import locations for the same thing.

The same edges appear from the re-exporting side as ModuleJson.reExports — use that when asking "what does this module re-export" instead of inverting these arrays. The two can disagree at the margins: a reExports entry whose canonical declaration is @nodocs (or whose module isn't in the analyzed set) has no back-link here.

Consumer note: To build a complete re-export map, scan two fields:

  1. alsoExportedFrom on each declaration — same-name re-exports
  2. aliasOf on declarations — renamed re-exports (separate declarations)

type string[]

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

reactivity?

Rune flavor when this variable is initialized with a value-producing reactivity rune.

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

defaultValue?

Default value documented via @default. Useful when the AST initializer is opaque (a call expression, computed value) and the author wants to document the conceptual default.

type string

typeInfo?

Structured type; absent when typeSignature is the whole story (see TypeJson).

type TypeJson

aliasOf?

For renamed re-exports (export {foo as bar}), points to the original declaration. This declaration's name is the alias; aliasOf.name is the original name.

For renames out of the default slot (export {default as bar} from './x' where ./x is export default ...), aliasOf.name is 'default' — the canonical's actual symbol name. Consumers locate the canonical by (aliasOf.module, aliasOf.name).

Svelte component exception: when the source is a .svelte file (e.g., export {default as Foo} from './X.svelte'), the canonical's name is the component name (derived from the filename), so aliasOf.name is the component name ('X'), NOT 'default'. Consumers that branch on aliasOf.name === 'default' to detect default-rename should additionally check whether aliasOf.module ends with .svelte.

Different from alsoExportedFrom: aliases create new API surface names, while alsoExportedFrom tracks additional import paths for the same name.

type { module: string; name: string; }

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

VariableMemberJson
#

types.ts view source

also exported from index.ts

{ kind: "variable"; optional: boolean; partial: boolean; examples: string[]; seeAlso: string[]; throws: { description: string; type?: string | undefined; }[]; name: string; modifiers: ("public" | "protected" | ... 4 more ... | "setter")[]; ... 10 more ...; sourceLine?: number | undefined; } import {VariableMemberJson} from 'svelte-docinfo/types.js';

A variable member (property, accessor, index signature, enum value). Shared fields plus optional reactivity for class fields initialized with a Svelte rune ($state, $state.raw, $derived, $derived.by).

optional reflects a ? token on the declaration (e.g., x?: string). Always false for index signatures and enum values.

kind

type "variable"

optional

Whether the member has a ? token in its declaration.

type boolean

partial

Whether extraction failed partway through, leaving some fields missing (e.g., typeSignature, parameters).

type boolean

examples

Code examples from @example tags.

type string[]

seeAlso

Related items from @see tags, in raw TSDoc format.

type string[]

throws

Exceptions from @throws tags.

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

name

The exported name. Always populated. The default-export slot is named 'default' — that's the symbol's actual name in JS (import {default as X} and ns.default both expose it directly), and import X from 'mod' is sugar for import {default as X}. Consumers branch on name === 'default' to render the sugar form when desired.

type string

modifiers

TypeScript modifiers like readonly, static, or protected.

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

genericParams

Generic type parameters like <T, U>.

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

reactivity?

Rune flavor when this field is initialized with a value-producing reactivity rune.

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

defaultValue?

Default value documented via @default. Authoritative initializer (when human-readable) is in typeSignature.

type string

typeInfo?

Structured type; absent when typeSignature is the whole story (see TypeJson). Member types are checker-backed everywhere — type-alias and interface properties and index signatures, class properties (annotated or inferred), and accessors (getter-backed or setter-only) all resolve through the checker, with written annotations feeding name recovery.

type TypeJson

internalMessage?

Internal-API marker from the @internal tag. Presence means the tag was written; an empty string is a bare tag with no trailing prose.

A marker, not an exclusion: @internal means "not stable public API" (TSDoc semantics) while the declaration stays documented — unlike @nodocs, which removes it from output entirely.

Deliberately here rather than in docFields: declarations and members only, not ComponentPropJson (widen to props as a separate additive change if demand appears).

type string

mutates?

Mutation documentation from @mutates tags (non-standard), mapping keys to descriptions.

Keys are intentionally unvalidated — typically a parameter name, but authors may also use compound paths (this.foo, obj.field) or external state references (globalCache). The schema accepts any string key so consumers can render whatever the author wrote.

type Record<string, string>

deprecatedMessage?

Deprecation message from @deprecated tag.

type string

since?

Version introduced, from @since tag.

type string

docComment?

JSDoc/TSDoc comment.

type string

typeSignature?

Full TypeScript type signature.

type string

sourceLine?

1-indexed line number in source file. Undefined for synthesized declarations (e.g., alias declarations from renamed re-exports).

type number

Imported by
#