Skip to content

Commit b52747e

Browse files
committed
Add property comments as well
1 parent 04d750f commit b52747e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/services/refactors/convertFunctionToEs6Class.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,10 @@ namespace ts.refactor {
197197
if (isSourceFileJavaScript(sourceFile)) {
198198
return;
199199
}
200-
return createProperty(/*decorators*/ undefined, modifiers, memberDeclaration.name, /*questionToken*/ undefined,
200+
const prop = createProperty(/*decorators*/ undefined, modifiers, memberDeclaration.name, /*questionToken*/ undefined,
201201
/*type*/ undefined, assignmentBinaryExpression.right);
202+
copyComments(assignmentBinaryExpression.parent, prop);
203+
return prop;
202204
}
203205
}
204206
}

tests/cases/fourslash/convertFunctionToEs6ClassJsDoc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// @allowNonTsExtensions: true
44
// @Filename: test123.js
55
//// function fn() {
6+
//// /** neat! */
67
//// this.x = 100;
78
//// }
89
////
@@ -16,6 +17,7 @@
1617
verify.fileAfterApplyingRefactorAtMarker('1',
1718
`class fn {
1819
constructor() {
20+
/** neat! */
1921
this.x = 100;
2022
}
2123
/**

0 commit comments

Comments
 (0)