Closed PopGoesTheWza closed 5 years ago
Please add a test case. Print the outputs of the test case in this PR.
There is already a test case with “export enum Language” defined. Actually, it is while checking this very test case that I found out the issue.
I will update with the output when done commuting
# testMultilineExports
v--TS--v
// next statement will be ignored
export { foo, bar }
from "file";
// next statement will be preserved
/** Supported languages for localized data */
export enum Languages {
/** English (USA) */
eng_us = 'eng_us',
/** French (France) */
fre_fr = 'fre_fr',
}
export class Client {
/** URL to the login endpoint */
private readonly signinUrl: string;
}
export function foo() {}
export default Client;
export
{ ZipCodeValidator };
// now resume with next statement
–––
// Compiled using ts2gas 1.6.1 (TypeScript 3.3.3333)
var exports = exports || {};
var module = module || { exports: exports };
//export { foo, bar }\n from "file";
// next statement will be preserved
/** Supported languages for localized data */
var Languages;
(function (Languages) {
/** English (USA) */
Languages["eng_us"] = "eng_us";
/** French (France) */
Languages["fre_fr"] = "fre_fr";
})(Languages = exports.Languages || (exports.Languages = {}));
var Client = /** @class */ (function () {
function Client() {
}
return Client;
}());
exports.Client = Client;
function foo() { }
exports.foo = foo;
// now resume with next statement
^--GS--^
@grant please bear with me. I am confused about this close/reopen buttons. So this PR fixes an issue I ran into while investigating #26 Test case was already in there. I pasted the correct test output above. As per the issue itself, please take a moment to review it and comment.
OK. Merged.
I'll have to add actual tests instead of console.log
-ing the test output.
See my comments in #26:
export enum Languages ...
produces an incorrect(Languages = Languages || (Languages = {}))
trailing code. The correct resulting javascript should read(Languages = exports.Languages || (exports.Languages = {}))