VS Code typescript: automatic execution interface

I have an interface in typescript and you want to execute it automatically.

I looked around and according to this thread_stack question and github problem, this function should already be there, but it does not work for me. There is no light bulb.

Implement autocomplete interface

+4
typescript visual-studio-code
source share
2 answers

Apparently eslint was somehow disabled.

0
source share

If the interface does not have required members, the action / quick fix code will not appear in the class definition.

interface IFoo { x?: number y?: number } class Foo implements IFoo { // no code action shown } 

But if the interface has at least one required element, then the code action will appear, and when clicked, all elements will be implemented, including nullable ones.

 interface IFoo { x: number y?: number } class Foo implements IFoo { // code action will appear. // will implement both x and y? when clicked } 

This behavior is due to the TypeScript compiler, not VS Code. You can track this issue as it is related to VS Code here , and TypeScript functionality here .

0
source share

All Articles