Answer:
Interfaces will be used by typscript at compile time, after that they will be removed and they will not be the part of final javascript output.
Eg :
interface IVehicle
{
engine:string;
fuel:string;
}
class Car implements IVehicle
{
constructor (public engine: string, public fuel: string) {
}
}
Above typescript code will compile to following javascript code :
var Car = /** @class */ (function () {
function Car(engine, fuel) {
this.engine = engine;
this.fuel = fuel;
}
return Car;
}());
Asked In: Euromonitor Bangalore Interview |
Alert Moderator