TypeScript/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts
Andy 24842b4002
When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors (#22361)
* When --noUnusedLocals/--noUnusedParameters is disabled, add suggestions instead of errors

* Improve performance: do not add unused suggestion diagnostics unless asking for a suggestion

* Add "unused" flag to diagnostics

* Code review

* reportsUnused -> reportsUnnecessary

* Fix test
2018-04-05 12:33:00 -07:00

49 lines
849 B
TypeScript

/// <reference path='fourslash.ts' />
// @allowNonTsExtensions: true
// @Filename: test123.js
////function fn() {
//// /** neat! */
//// this.x = 100;
////}
////
/////** awesome
//// * stuff
//// */
////fn.prototype.arr = () => { return ""; }
/////** great */
////fn.prototype.arr2 = () => [];
////
/////**
//// * This is a cool function!
////*/
////fn.prototype.bar = function (y) {
//// this.x = y;
////};
verify.codeFix({
description: "Convert function to an ES2015 class",
newFileContent:
`class fn {
constructor() {
/** neat! */
this.x = 100;
}
/** awesome
* stuff
*/
arr() { return ""; }
/** great */
arr2() { return []; }
/**
* This is a cool function!
*/
bar(y) {
this.x = y;
}
}
`,
});