UNPKG

shelving

Version:

Toolkit for using data in JavaScript.

18 lines (17 loc) 1.07 kB
import type { FileElementProps } from "../util/element.js"; import { FileExtractor } from "./FileExtractor.js"; /** * File extractor that parses a TypeScript source file into a tree element. * - Uses the TypeScript compiler API to parse the AST. * - Extracts exported, public, non-`_`-prefixed declarations as `tree-documentation` children. * - Overloaded declarations sharing a name are merged into a single `tree-documentation` with multiple `signatures`. * - Top-of-file JSDoc comment becomes the file's `content`. * - Sets `description` (a plain-text summary from the first JSDoc paragraph) on the file and every `tree-documentation` child. * - Sets `title` on every `tree-documentation` child — `name()` for functions and methods, `name` for other kinds. * - The file element itself has no `title` — a TS source file has no confident title source; renderers fall back to `name`. */ export declare class TypescriptExtractor extends FileExtractor { extractProps(name: string, text: string): Partial<FileElementProps> & { name: string; }; }