1 | import type * as ts from "typescript";
|
2 | import { type ReferenceType, type Type, type SomeType } from "../types";
|
3 | import { type TraverseCallback } from "./abstract";
|
4 | import { ContainerReflection } from "./container";
|
5 | import type { SignatureReflection } from "./signature";
|
6 | import type { TypeParameterReflection } from "./type-parameter";
|
7 | import type { Serializer, JSONOutput, Deserializer } from "../../serialization";
|
8 | import { type CommentDisplayPart } from "../comments";
|
9 | import { SourceReference } from "../sources/file";
|
10 | /**
|
11 | * Stores hierarchical type data.
|
12 | *
|
13 | * @see {@link DeclarationReflection.typeHierarchy}
|
14 | */
|
15 | export interface DeclarationHierarchy {
|
16 | /**
|
17 | * The types represented by this node in the hierarchy.
|
18 | */
|
19 | types: Type[];
|
20 | /**
|
21 | * The next hierarchy level.
|
22 | */
|
23 | next?: DeclarationHierarchy;
|
24 | /**
|
25 | * Is this the entry containing the target type?
|
26 | */
|
27 | isTarget?: boolean;
|
28 | }
|
29 | /**
|
30 | * A reflection that represents a single declaration emitted by the TypeScript compiler.
|
31 | *
|
32 | * All parts of a project are represented by DeclarationReflection instances. The actual
|
33 | * kind of a reflection is stored in its ´kind´ member.
|
34 | * @category Reflections
|
35 | */
|
36 | export declare class DeclarationReflection extends ContainerReflection {
|
37 | readonly variant: "declaration" | "reference";
|
38 | /**
|
39 | * A list of all source files that contributed to this reflection.
|
40 | */
|
41 | sources?: SourceReference[];
|
42 | /**
|
43 | * A precomputed boost derived from the searchCategoryBoosts and searchGroupBoosts options, used when
|
44 | * boosting search relevance scores at runtime. May be modified by plugins.
|
45 | */
|
46 | relevanceBoost?: number;
|
47 | /**
|
48 | * The escaped name of this declaration assigned by the TS compiler if there is an associated symbol.
|
49 | * This is used to retrieve properties for analyzing inherited members.
|
50 | *
|
51 | * Not serialized, only useful during conversion.
|
52 | * @internal
|
53 | */
|
54 | escapedName?: ts.__String;
|
55 | /**
|
56 | * The type of the reflection.
|
57 | *
|
58 | * If the reflection represents a variable or a property, this is the value type.<br />
|
59 | * If the reflection represents a signature, this is the return type.
|
60 | */
|
61 | type?: SomeType;
|
62 | typeParameters?: TypeParameterReflection[];
|
63 | /**
|
64 | * A list of call signatures attached to this declaration.
|
65 | *
|
66 | * TypeDoc creates one declaration per function that may contain one or more
|
67 | * signature reflections.
|
68 | */
|
69 | signatures?: SignatureReflection[];
|
70 | /**
|
71 | * The index signature of this declaration.
|
72 | */
|
73 | indexSignatures?: SignatureReflection[];
|
74 | /**
|
75 | * The get signature of this declaration.
|
76 | */
|
77 | getSignature?: SignatureReflection;
|
78 | /**
|
79 | * The set signature of this declaration.
|
80 | */
|
81 | setSignature?: SignatureReflection;
|
82 | /**
|
83 | * The default value of this reflection.
|
84 | *
|
85 | * Applies to function parameters, variables, and properties.
|
86 | */
|
87 | defaultValue?: string;
|
88 | /**
|
89 | * A type that points to the reflection that has been overwritten by this reflection.
|
90 | *
|
91 | * Applies to interface and class members.
|
92 | */
|
93 | overwrites?: ReferenceType;
|
94 | /**
|
95 | * A type that points to the reflection this reflection has been inherited from.
|
96 | *
|
97 | * Applies to interface and class members.
|
98 | */
|
99 | inheritedFrom?: ReferenceType;
|
100 | /**
|
101 | * A type that points to the reflection this reflection is the implementation of.
|
102 | *
|
103 | * Applies to class members.
|
104 | */
|
105 | implementationOf?: ReferenceType;
|
106 | /**
|
107 | * A list of all types this reflection extends (e.g. the parent classes).
|
108 | */
|
109 | extendedTypes?: SomeType[];
|
110 | /**
|
111 | * A list of all types that extend this reflection (e.g. the subclasses).
|
112 | */
|
113 | extendedBy?: ReferenceType[];
|
114 | /**
|
115 | * A list of all types this reflection implements.
|
116 | */
|
117 | implementedTypes?: SomeType[];
|
118 | /**
|
119 | * A list of all types that implement this reflection.
|
120 | */
|
121 | implementedBy?: ReferenceType[];
|
122 | /**
|
123 | * Contains a simplified representation of the type hierarchy suitable for being
|
124 | * rendered in templates.
|
125 | */
|
126 | typeHierarchy?: DeclarationHierarchy;
|
127 | /**
|
128 | * The contents of the readme file of the module when found.
|
129 | */
|
130 | readme?: CommentDisplayPart[];
|
131 | /**
|
132 | * The version of the module when found.
|
133 | */
|
134 | packageVersion?: string;
|
135 | isDeclaration(): this is DeclarationReflection;
|
136 | hasGetterOrSetter(): boolean;
|
137 | getAllSignatures(): SignatureReflection[];
|
138 | /** @internal */
|
139 | getNonIndexSignatures(): SignatureReflection[];
|
140 | traverse(callback: TraverseCallback): void;
|
141 | /**
|
142 | * Return a string representation of this reflection.
|
143 | */
|
144 | toString(): string;
|
145 | toObject(serializer: Serializer): JSONOutput.DeclarationReflection;
|
146 | fromObject(de: Deserializer, obj: JSONOutput.DeclarationReflection | JSONOutput.ProjectReflection): void;
|
147 | }
|