UNPKG

1.75 kBTypeScriptView Raw
1import ts from "typescript";
2import type { JSONOutput, Serializer } from "../../serialization/index";
3import type { DeclarationReference } from "../../converter/comments/declarationReference";
4/**
5 * See {@link ReflectionSymbolId}
6 */
7export type ReflectionSymbolIdString = string & {
8 readonly __reflectionSymbolId: unique symbol;
9};
10/**
11 * This exists so that TypeDoc can store a unique identifier for a `ts.Symbol` without
12 * keeping a reference to the `ts.Symbol` itself. This identifier should be stable across
13 * runs so long as the symbol is exported from the same file.
14 */
15export declare class ReflectionSymbolId {
16 readonly fileName: string;
17 readonly qualifiedName: string;
18 /**
19 * Note: This is **not** serialized. It exists for sorting by declaration order, but
20 * should not be needed when deserializing from JSON.
21 * Will be set to `Infinity` if the ID was deserialized from JSON.
22 */
23 pos: number;
24 /**
25 * Note: This is **not** serialized. It exists to support detection of the differences between
26 * symbols which share declarations, but are instantiated with different type parameters.
27 * This will be `NaN` if the symbol reference is not transient.
28 * Note: This can only be non-NaN if {@link pos} is finite.
29 */
30 transientId: number;
31 constructor(symbol: ts.Symbol, declaration?: ts.Declaration);
32 constructor(json: JSONOutput.ReflectionSymbolId);
33 getStableKey(): ReflectionSymbolIdString;
34 toDeclarationReference(): DeclarationReference;
35 toObject(serializer: Serializer): {
36 sourceFileName: string;
37 qualifiedName: string;
38 };
39}
40export declare function addInferredDeclarationMapPaths(opts: ts.CompilerOptions, files: readonly string[]): void;