UNPKG

2.04 kBTypeScriptView Raw
1import { DeclarationReflection } from "./declaration";
2import type { Serializer, JSONOutput, Deserializer } from "../../serialization";
3import type { Reflection } from "./abstract";
4/**
5 * Describes a reflection which does not exist at this location, but is referenced. Used for imported reflections.
6 *
7 * ```ts
8 * // a.ts
9 * export const a = 1;
10 * // b.ts
11 * import { a } from './a';
12 * // Here to avoid extra work we create a reference to the original reflection in module a instead
13 * // of copying the reflection.
14 * export { a };
15 * ```
16 * @category Reflections
17 */
18export declare class ReferenceReflection extends DeclarationReflection {
19 readonly variant = "reference";
20 private _target;
21 /**
22 * Creates a reference reflection. Should only be used within the factory function.
23 * @internal
24 */
25 constructor(name: string, reflection: Reflection, parent?: Reflection);
26 /**
27 * Tries to get the reflection that is referenced. This may be another reference reflection.
28 * To fully resolve any references, use {@link tryGetTargetReflectionDeep}.
29 */
30 tryGetTargetReflection(): Reflection | undefined;
31 /**
32 * Tries to get the reflection that is referenced, this will fully resolve references.
33 * To only resolve one reference, use {@link tryGetTargetReflection}.
34 */
35 tryGetTargetReflectionDeep(): Reflection | undefined;
36 /**
37 * Gets the reflection that is referenced. This may be another reference reflection.
38 * To fully resolve any references, use {@link getTargetReflectionDeep}.
39 */
40 getTargetReflection(): Reflection;
41 /**
42 * Gets the reflection that is referenced, this will fully resolve references.
43 * To only resolve one reference, use {@link getTargetReflection}.
44 */
45 getTargetReflectionDeep(): Reflection;
46 getChildByName(arg: string | string[]): Reflection | undefined;
47 toObject(serializer: Serializer): JSONOutput.ReferenceReflection;
48 fromObject(de: Deserializer, obj: JSONOutput.ReferenceReflection): void;
49}