Skip to content

Instantly share code, notes, and snippets.

@oupo
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oupo/9375752 to your computer and use it in GitHub Desktop.
Save oupo/9375752 to your computer and use it in GitHub Desktop.
2つのTypeScriptファイルを連結して、1つのNode用JSファイルにしたい。tsc t.js --module commonjs --out out.js としてみると出力にt.tsの2行がない
module sub {
export function x() {
console.log("x");
}
function y() {
console.log("y");
}
}
///<reference path="node.d.ts"/>
///<reference path="sub.ts"/>
import fs = require("fs");
console.log(fs.readFileSync("t.ts"));
// 期待する出力結果
var sub;
(function (sub) {
function x() {
console.log("x");
}
sub.x = x;
function y() {
console.log("y");
}
})(sub || (sub = {}));
var fs = require("fs");
console.log(fs.readFileSync("t.ts"));
// 実際の出力結果
var sub;
(function (sub) {
function x() {
console.log("x");
}
sub.x = x;
function y() {
console.log("y");
}
})(sub || (sub = {}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment