TypeScript/tests/cases/fourslash/codeFixAddMissingMember18_declarePrivateMethod.ts
Alexander T 683b3ec058
feat(37782): 'declare method' quick fix for adding a private method (#37806)
* feat(37782): add quick-fix action to declare a private method for names that start from underscore

* better merge order in messages json

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-05-06 15:10:02 -07:00

30 lines
687 B
TypeScript

/// <reference path='fourslash.ts' />
////class A {
//// constructor() {
//// this._foo();
//// }
////}
verify.codeFixAvailable([
{ description: "Declare private method '_foo'" },
{ description: "Declare method '_foo'" },
{ description: "Declare private property '_foo'" },
{ description: "Declare property '_foo'" },
{ description: "Add index signature for property '_foo'" }
])
verify.codeFix({
description: [ts.Diagnostics.Declare_private_method_0.message, "_foo"],
index: 0,
newFileContent:
`class A {
constructor() {
this._foo();
}
private _foo() {
throw new Error("Method not implemented.");
}
}`
});