diff --git a/__tests__/formats/__snapshots__/all.test.js.snap b/__tests__/formats/__snapshots__/all.test.js.snap index 68a363460..f514a9bd6 100644 --- a/__tests__/formats/__snapshots__/all.test.js.snap +++ b/__tests__/formats/__snapshots__/all.test.js.snap @@ -751,7 +751,8 @@ exports[`formats all should match typescript/es6-declarations snapshot 1`] = ` * Generated on Sat, 01 Jan 2000 00:00:00 GMT */ -export const color_red : string; // comment" +/** comment */ +export const color_red : string;" `; exports[`formats all should match typescript/module-declarations snapshot 1`] = ` diff --git a/__tests__/formats/__snapshots__/typeScriptEs6Declarations.test.js.snap b/__tests__/formats/__snapshots__/typeScriptEs6Declarations.test.js.snap index a79911ae8..9343df8be 100644 --- a/__tests__/formats/__snapshots__/typeScriptEs6Declarations.test.js.snap +++ b/__tests__/formats/__snapshots__/typeScriptEs6Declarations.test.js.snap @@ -6,5 +6,6 @@ exports[`formats typescript/es6-declarations with outputStringLiterals should ma * Generated on Sat, 01 Jan 2000 00:00:00 GMT */ +/** Used for errors */ export const colorRed : \\"#FF0000\\";" `; diff --git a/__tests__/formats/typeScriptEs6Declarations.test.js b/__tests__/formats/typeScriptEs6Declarations.test.js index 10556349c..b9517a71b 100644 --- a/__tests__/formats/typeScriptEs6Declarations.test.js +++ b/__tests__/formats/typeScriptEs6Declarations.test.js @@ -22,6 +22,7 @@ const file = { const properties = { "color": { "red": { + "comment": "Used for errors", "name": "colorRed", "value": "#FF0000" } diff --git a/lib/common/formats.js b/lib/common/formats.js index d4da2aa77..3b9d631d5 100644 --- a/lib/common/formats.js +++ b/lib/common/formats.js @@ -407,9 +407,10 @@ module.exports = { 'typescript/es6-declarations': function({dictionary, file, options}) { return fileHeader({file}) + dictionary.allProperties.map(function(prop) { - var to_ret_prop = 'export const ' + prop.name + ' : ' + getTypeScriptType(prop.value, options) + ';'; + let to_ret_prop = ''; if (prop.comment) - to_ret_prop = to_ret_prop.concat(' // ' + prop.comment); + to_ret_prop += '/** ' + prop.comment + ' */\n'; + to_ret_prop += 'export const ' + prop.name + ' : ' + getTypeScriptType(prop.value, options) + ';'; return to_ret_prop; }).join('\n'); },