typescript-extract-shared.ts view source
(declaration: DeclarationJsonBuild, heritageTypes: readonly ExpressionWithTypeArguments[], ctx: ExtractContext): void import {applyHeritageExternalTypes} from 'svelte-docinfo/typescript-extract-shared.js'; Set a declaration's externalTypes from its own heritage entries — the
interface/class counterpart of filterDocumentedProperties' annotation
walk, and the one place the two heritage-bearing extractors express it.
Classes enumerate own members only, and interfaces don't enumerate a
named base's (a computed entry's external properties are filtered, by
extractComputedHeritageMembers) — what the field records there is the
external types the heritage composition reaches whose contributions
members therefore never enumerates: `interface Props extends
HTMLButtonAttributes` records the bag, directly or through a local base
chain, exactly as the same interface annotating $props() records it on
the component. Local bases reached and fully enumerated nowhere are the
extends field's business, not this one.
Only extends entries are passed by either caller: an interface has no
other clause kind, and a class's implements adds no members.
Scoped to the processed declaration's own heritage clauses — the same node
extends and members come from — so on a merged interface only the
selected block contributes, while a reference to that interface elsewhere
descends every block. The three fields stay consistent with each other rather
than with the descent.
declaration
heritageTypes
readonly ExpressionWithTypeArguments[]ctx
returns
void mutates
declaration— sets `externalTypes` when the walk finds any, left absent when not