Home > ts-morph-structures > ImportManager
This manages import declarations and specifiers, for including in a source file.
Signature:
export default class ImportManager
importsManager.addImports({
pathToImportedModule: "ts-morph",
isPackageImport: true,
importNames: ["Structure", "StructureKind"],
isDefaultImport: false,
isTypeOnly: true
});
// ...
sourceFile.statements.unshift(...importsManager.getDeclarations());
| Constructor | Modifiers | Description |
|---|---|---|
| [(constructor)(absolutePathToModule)](/es-membrane/ts-morph-structures/api/ts-morph-structures.importmanager._constructor_.html) | Constructs a new instance of the `ImportManager` class |
| Property | Modifiers | Type | Description |
|---|---|---|---|
| [absolutePathToModule](/es-membrane/ts-morph-structures/api/ts-morph-structures.importmanager.absolutepathtomodule.html) | `readonly` | string | Where the file will live on the file system. |
| Method | Modifiers | Description |
|---|---|---|
| [addImports(context)](/es-membrane/ts-morph-structures/api/ts-morph-structures.importmanager.addimports.html) | ||
| [getDeclarations()](/es-membrane/ts-morph-structures/api/ts-morph-structures.importmanager.getdeclarations.html) | Get the import declarations, sorted by path to file, then internally by specified import values. |