Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extending interfaces and hover hints

I am working with TypeScript in VS Code. I have three interfaces: A, B and C, each one with two properties. C extends A and B.

interface A {
  A1: boolean;
  A2: boolean;
}

interface B {
  B1: boolean;
  B2: boolean;
}

interface C extends A, B {
  C1: boolean;
  C2: boolean;
}

const ABC: C = {
  A1: true,
  A2: true,
  B1: true,
  B2: true,
  C1: true,
  C2: true,
};

console.log(ABC);

When I hover C I only see its own properties.

This is not convenient, as I can't see the whole interface in the codebase when I use C for any object.

enter image description here Is this intended?

like image 563
Emille C. Avatar asked May 15 '26 02:05

Emille C.


1 Answers

This is intended because otherwise when extending a more sophisticated interface (like HTMLELement) your preview would get bloated with properties not inherently relevant to your interface. If you really need an index of all avaliable properties of C, just write ABC. (when nothing happens try Ctrl+Space). Or Ctrl+click on C to see its declaration and further on A or B to inspect those.

like image 102
MaximilianMairinger Avatar answered May 18 '26 02:05

MaximilianMairinger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!