File size: 7,138 Bytes
31248b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/**
 * Represents a reference to a declaration.
 * @beta
 */
export declare class DeclarationReference {
    private _source;
    private _navigation;
    private _symbol;
    constructor(source?: ModuleSource | GlobalSource, navigation?: Navigation.Locals | Navigation.Exports, symbol?: SymbolReference);
    get source(): ModuleSource | GlobalSource | undefined;
    get navigation(): Navigation.Locals | Navigation.Exports | undefined;
    get symbol(): SymbolReference | undefined;
    get isEmpty(): boolean;
    static parse(text: string): DeclarationReference;
    static parseComponent(text: string): Component;
    /**
     * Determines whether the provided string is a well-formed symbol navigation component string.
     */
    static isWellFormedComponentString(text: string): boolean;
    /**
     * Escapes a string for use as a symbol navigation component. If the string contains any of `!.#~:,"{}()@` or starts
     * with `[`, it is enclosed in quotes.
     */
    static escapeComponentString(text: string): string;
    /**
     * Unescapes a string used as a symbol navigation component.
     */
    static unescapeComponentString(text: string): string;
    /**
     * Determines whether the provided string is a well-formed module source string. The string may not
     * have a trailing `!` character.
     */
    static isWellFormedModuleSourceString(text: string): boolean;
    /**
     * Escapes a string for use as a module source. If the string contains any of `!"` it is enclosed in quotes.
     */
    static escapeModuleSourceString(text: string): string;
    /**
     * Unescapes a string used as a module source. The string may not have a trailing `!` character.
     */
    static unescapeModuleSourceString(text: string): string;
    static empty(): DeclarationReference;
    static package(packageName: string, importPath?: string): DeclarationReference;
    static module(path: string, userEscaped?: boolean): DeclarationReference;
    static global(): DeclarationReference;
    static from(base: DeclarationReference | undefined): DeclarationReference;
    withSource(source: ModuleSource | GlobalSource | undefined): DeclarationReference;
    withNavigation(navigation: Navigation.Locals | Navigation.Exports | undefined): DeclarationReference;
    withSymbol(symbol: SymbolReference | undefined): DeclarationReference;
    withComponentPath(componentPath: ComponentPath): DeclarationReference;
    withMeaning(meaning: Meaning | undefined): DeclarationReference;
    withOverloadIndex(overloadIndex: number | undefined): DeclarationReference;
    addNavigationStep(navigation: Navigation, component: ComponentLike): DeclarationReference;
    toString(): string;
}
/**
 * Indicates the symbol table from which to resolve the next symbol component.
 * @beta
 */
export declare enum Navigation {
    Exports = ".",
    Members = "#",
    Locals = "~"
}
/**
 * Represents a module.
 * @beta
 */
export declare class ModuleSource {
    readonly escapedPath: string;
    private _path;
    private _pathComponents;
    constructor(path: string, userEscaped?: boolean);
    get path(): string;
    get packageName(): string;
    get scopeName(): string;
    get unscopedPackageName(): string;
    get importPath(): string;
    static fromScopedPackage(scopeName: string | undefined, unscopedPackageName: string, importPath?: string): ModuleSource;
    static fromPackage(packageName: string, importPath?: string): ModuleSource;
    private static _fromPackageName;
    toString(): string;
    private _getOrParsePathComponents;
}
/**
 * Represents the global scope.
 * @beta
 */
export declare class GlobalSource {
    static readonly instance: GlobalSource;
    private constructor();
    toString(): string;
}
/**
 * @beta
 */
export type Component = ComponentString | ComponentReference;
/**
 * @beta
 */
export declare namespace Component {
    function from(value: ComponentLike): Component;
}
/**
 * @beta
 */
export type ComponentLike = Component | DeclarationReference | string;
/**
 * @beta
 */
export declare class ComponentString {
    readonly text: string;
    constructor(text: string, userEscaped?: boolean);
    toString(): string;
}
/**
 * @beta
 */
export declare class ComponentReference {
    readonly reference: DeclarationReference;
    constructor(reference: DeclarationReference);
    static parse(text: string): ComponentReference;
    withReference(reference: DeclarationReference): ComponentReference;
    toString(): string;
}
/**
 * @beta
 */
export type ComponentPath = ComponentRoot | ComponentNavigation;
/**
 * @beta
 */
export declare abstract class ComponentPathBase {
    readonly component: Component;
    constructor(component: Component);
    addNavigationStep(this: ComponentPath, navigation: Navigation, component: ComponentLike): ComponentPath;
    abstract toString(): string;
}
/**
 * @beta
 */
export declare class ComponentRoot extends ComponentPathBase {
    withComponent(component: ComponentLike): ComponentRoot;
    toString(): string;
}
/**
 * @beta
 */
export declare class ComponentNavigation extends ComponentPathBase {
    readonly parent: ComponentPath;
    readonly navigation: Navigation;
    constructor(parent: ComponentPath, navigation: Navigation, component: Component);
    withParent(parent: ComponentPath): ComponentNavigation;
    withNavigation(navigation: Navigation): ComponentNavigation;
    withComponent(component: ComponentLike): ComponentNavigation;
    toString(): string;
}
/**
 * @beta
 */
export declare enum Meaning {
    Class = "class",// SymbolFlags.Class
    Interface = "interface",// SymbolFlags.Interface
    TypeAlias = "type",// SymbolFlags.TypeAlias
    Enum = "enum",// SymbolFlags.Enum
    Namespace = "namespace",// SymbolFlags.Module
    Function = "function",// SymbolFlags.Function
    Variable = "var",// SymbolFlags.Variable
    Constructor = "constructor",// SymbolFlags.Constructor
    Member = "member",// SymbolFlags.ClassMember | SymbolFlags.EnumMember
    Event = "event",//
    CallSignature = "call",// SymbolFlags.Signature (for __call)
    ConstructSignature = "new",// SymbolFlags.Signature (for __new)
    IndexSignature = "index",// SymbolFlags.Signature (for __index)
    ComplexType = "complex"
}
/**
 * @beta
 */
export interface ISymbolReferenceOptions {
    meaning?: Meaning;
    overloadIndex?: number;
}
/**
 * Represents a reference to a TypeScript symbol.
 * @beta
 */
export declare class SymbolReference {
    readonly componentPath: ComponentPath | undefined;
    readonly meaning: Meaning | undefined;
    readonly overloadIndex: number | undefined;
    constructor(component: ComponentPath | undefined, { meaning, overloadIndex }?: ISymbolReferenceOptions);
    static empty(): SymbolReference;
    withComponentPath(componentPath: ComponentPath | undefined): SymbolReference;
    withMeaning(meaning: Meaning | undefined): SymbolReference;
    withOverloadIndex(overloadIndex: number | undefined): SymbolReference;
    addNavigationStep(navigation: Navigation, component: ComponentLike): SymbolReference;
    toString(): string;
}
//# sourceMappingURL=DeclarationReference.d.ts.map