The Generic part in below line in abc which is in <> .
Actually as I am coming from Javascript side to Typescript side in angular 2 .
That's why I am not seen these Generic part in Javascript .
export interface Animals<abc>
export class WaterAnimal <abc> implements Animals<abc> { }
Things which I get :
- Generic Part helps to maintain the type which we are sending and achieving from any function will be of same type that type can be any Object,String,Number or Array.
Eg :-
function identity<T>(arg: T): T {
return arg;
}
Things I want to Ask:-
When We come in Classes and Interfaces :- by passing the parameters in Interface as in Animals interface what is the purpose of it .
If there is any purpose which i don't aware of yet ,now if we implements that Animal Interface to WaterAnimal Class then I want to write
<abc>infront of Animal Interface because while defining that Interface I have pass that thing as parameter into it .So Why complier is forcing me to define<abc>with the WaterAnimal Class ..Is there is any Reason behind this..
Any help will be appreciated .