import type { TypescriptSourceFileId } from './typescript-source-file-id'; export interface TypescriptImport { /** * The type of import being used (default or named). */ readonly importType: 'default' | 'named'; /** * Boolean indicating if the import refers to a local file, or an external package. */ readonly local: boolean; /** * The raw import clause for this import, not including syntax specific to default or named imports. * If the resulting import statement was: `import defaultName, { namedImport, aliasedImport as myAliasedImport } from './file';` * The import clauses are: 'defaultName', 'namedImport', and 'aliasedImport as myAliasedImport' */ readonly importClause: string; /** * The name of the imported variable as it was exported from the original module. * For default imports just the import name. * For aliased imports, it is the original. (i.e. namedImport in `namedImport as myVar`) */ readonly defaultImportName: string; /** * The name of the imported variable as it will be used in code. * For default imports and unaliased named imports, just the import name. * For aliased imports, it is the alias. (i.e. myVar in `namedImport as myVar`) */ readonly importName: string; /** * A string that identifies the module this import refers to. */ readonly moduleId: string; /** * Build the module that this import refers to. * For external imports, this just gets the module ID. * For local imports, this builds the relative path from the given source file to the imported module. */ generateImportModule(sourceFile: TypescriptSourceFileId): string; } export declare abstract class LocalTypescriptImport implements TypescriptImport { readonly id: TypescriptSourceFileId; readonly importType: 'default' | 'named'; local: boolean; abstract get importClause(): string; abstract get importName(): string; abstract get defaultImportName(): string; constructor(id: TypescriptSourceFileId, importType: 'default' | 'named'); generateImportModule(sourceFileId: TypescriptSourceFileId): string; get moduleId(): string; } export declare class LocalTypescriptDefaultImport extends LocalTypescriptImport { readonly id: TypescriptSourceFileId; readonly asName: string; constructor(id: TypescriptSourceFileId, asName: string); get importName(): string; get defaultImportName(): string; get importClause(): string; } export declare class LocalTypescriptNamedImport extends LocalTypescriptImport { readonly id: TypescriptSourceFileId; readonly defaultImportName: string; readonly asAlias?: string | undefined; constructor(id: TypescriptSourceFileId, defaultImportName: string, asAlias?: string | undefined); get importName(): string; get importClause(): string; } export declare abstract class ExternalTypescriptImport implements TypescriptImport { readonly moduleName: string; importType: 'named' | 'default'; local: boolean; abstract get importClause(): string; abstract get importName(): string; abstract get defaultImportName(): string; constructor(moduleName: string, importType: 'named' | 'default'); generateImportModule(): string; get moduleId(): string; } export declare class ExternalTypescriptDefaultImport extends ExternalTypescriptImport { readonly moduleName: string; readonly asName: string; constructor(moduleName: string, asName: string); get importClause(): string; get importName(): string; get defaultImportName(): string; } export declare class ExternalTypescriptNamedImport extends ExternalTypescriptImport { readonly moduleName: string; readonly defaultImportName: string; readonly asAlias?: string | undefined; constructor(moduleName: string, defaultImportName: string, asAlias?: string | undefined); get importName(): string; get importClause(): string; }