ES6 does have class inheritance. Classes are inherited by extends
.
When you use implements
you are asking for type checking against an interface. If you want type checking you should be using Typescript - if you don't need type checking then you don't need implements
. Using implements doesn't have an effect on the output code — it's just for type checking during compile.
For example in typescript:
class myClass{
public myID:number
constructor(){
}
talk(){
console.log("hi there");
}
}
class newClass {
public myID:number;
talk(){
console.log("Hi from new Class");
}
}
class newClassImplements implements myClass {
public myID:number;
talk(){
console.log("Hi from new Class");
}
}
newClass
and newClassImplements
both result in exactly the same javascript after compilation. The version with implements
just asks the compiler to make sure it has the same interface as myClass
if it doesn't you get an error at compilation.
In your sample above ValuesPipe
isn't inheriting from PipeTransform
it's simply implementing the interface. If you don't need the type checking you should be able to just write the function you want and forget about implementing the interface.