TypeScript/tests/cases/fourslash/codeFixImplicitThis_ts_functionExpression.ts
Andy Hanson b0450aed56
Add codefix for --noImplicitThis (#27565)
* Add codefix for --noImplicitThis

* Code review

* Back to building post-merge

* Remove redundant functions + update tests

Infer-from-usage also inserts `this: any` parameters when needed, so I
removed that from fixImplicitThis.

Otherwise, fixImplicitThis has better suggestions than inferFromUsage,
so I moved inferFromUsage later in the suggestion order.

* More redundancy removal

Don't need to add `@this` anymore either since inferFromUsage will do
that.

* More baseline updates

From moving inferFromUsage down in priority I think?

* remove now-redundant ad-hoc jsdoc emit

* fix more bad merge

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2020-03-17 13:00:14 -07:00

25 lines
403 B
TypeScript

/// <reference path='fourslash.ts' />
// @noImplicitThis: true
////class C {
//// m() {
//// return function f() {
//// return this;
//// };
//// }
////}
verify.codeFix({
description: "Convert function expression 'f' to arrow function",
index: 0,
newFileContent:
`class C {
m() {
return () => {
return this;
};
}
}`,
});