TypeScript/tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts

49 lines
849 B
TypeScript
Raw Normal View History

/// <reference path='fourslash.ts' />
// @allowNonTsExtensions: true
// @Filename: test123.js
////function fn() {
//// /** neat! */
//// this.x = 100;
////}
2017-06-30 00:14:09 +02:00
////
/////** 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() {
2017-06-26 19:54:18 +02:00
/** neat! */
this.x = 100;
}
2017-06-30 00:14:09 +02:00
/** awesome
* stuff
*/
arr() { return ""; }
/** great */
arr2() { return []; }
/**
* This is a cool function!
*/
bar(y) {
this.x = y;
}
}
2017-06-30 00:14:09 +02:00
`,
});