UNPKG

2.24 kBTypeScriptView Raw
1import * as ts from 'typescript';
2import { AstModule, AstModuleExportInfo } from './AstModule';
3import { AstSyntheticEntity } from './AstEntity';
4import { Collector } from '../collector/Collector';
5export interface IAstNamespaceImportOptions {
6 readonly astModule: AstModule;
7 readonly namespaceName: string;
8 readonly declaration: ts.Declaration;
9}
10/**
11 * `AstNamespaceImport` represents a namespace that is created implicitly by a statement
12 * such as `import * as example from "./file";`
13 *
14 * @remarks
15 *
16 * A typical input looks like this:
17 * ```ts
18 * // Suppose that example.ts exports two functions f1() and f2().
19 * import * as example from "./file";
20 * export { example };
21 * ```
22 *
23 * API Extractor's .d.ts rollup will transform it into an explicit namespace, like this:
24 * ```ts
25 * declare f1(): void;
26 * declare f2(): void;
27 *
28 * declare namespace example {
29 * export {
30 * f1,
31 * f2
32 * }
33 * }
34 * ```
35 *
36 * The current implementation does not attempt to relocate f1()/f2() to be inside the `namespace`
37 * because other type signatures may reference them directly (without using the namespace qualifier).
38 * The `declare namespace example` is a synthetic construct represented by `AstNamespaceImport`.
39 */
40export declare class AstNamespaceImport extends AstSyntheticEntity {
41 /**
42 * Returns true if the AstSymbolTable.analyze() was called for this object.
43 * See that function for details.
44 */
45 analyzed: boolean;
46 /**
47 * For example, if the original statement was `import * as example from "./file";`
48 * then `astModule` refers to the `./file.d.ts` file.
49 */
50 readonly astModule: AstModule;
51 /**
52 * For example, if the original statement was `import * as example from "./file";`
53 * then `namespaceName` would be `example`.
54 */
55 readonly namespaceName: string;
56 /**
57 * The original `ts.SyntaxKind.NamespaceImport` which can be used as a location for error messages.
58 */
59 readonly declaration: ts.Declaration;
60 constructor(options: IAstNamespaceImportOptions);
61 /** {@inheritdoc} */
62 get localName(): string;
63 fetchAstModuleExportInfo(collector: Collector): AstModuleExportInfo;
64}
65//# sourceMappingURL=AstNamespaceImport.d.ts.map
\No newline at end of file