When you import a module normally, the compiler can figure out that there is no need to emit an import statement because no concrete code is being used.
For example:
component.ts
export interface MyInterface {
name: string;
}
app.ts
import { MyInterface } from './component';
class MyClass implements MyInterface {
constructor(public name: string) { }
}
The app.js file would look like this in ES2015:
class MyClass {
constructor(name) {
this.name = name;
}
}
Alternatively, in older ES5 terms:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MyClass = /** @class */ (function () {
function MyClass(name) {
this.name = name;
}
return MyClass;
}());
The key point is that the TypeScript compiler recognizes that the import statement is only necessary during compilation and not at runtime.