I have an interface in typescript and want to autoimplement it.
I\'ve been looking around and according to this stackoverflow question and github issue, this feature
If the interface has no required members, then the code action/quick fix will not appear on 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 member, then the code action will appear, and when clicked, will implement all the members, including the 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 TypeScript's compiler, not VS Code. You can track this issue as it related to VS Code here, and the TypeScript functionality here.