Reputation: 897
I am pretty new to Typescript. Please help me in explaining what is wrong with the below code snippet.
interface ICalcValue {
readonly IsNumber : boolean;
readonly : IsString : boolean;
}
interface ICalcValue<T> extends ICalcValue {
readonly T Value;
}
Upvotes: 0
Views: 589
Reputation: 250236
Unlike other languages (ex C#). Having two types that differ only by type parameters is not possible in typescript. You will need to use different names for the interfaces (fixing the other minor syntax errors):
interface ICalcValueBase {
readonly IsNumber: boolean;
readonly IsString: boolean;
}
interface ICalcValue<T> extends ICalcValueBase {
readonly Value: T;
}
Upvotes: 1