0

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;

}
1
  • At least could you give some details about the error you get when you try to compile it. Commented Sep 2, 2019 at 8:16

1 Answer 1

1

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;

}

play

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.