Last active
August 29, 2015 13:57
-
-
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行がない
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module sub { | |
export function x() { | |
console.log("x"); | |
} | |
function y() { | |
console.log("y"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///<reference path="node.d.ts"/> | |
///<reference path="sub.ts"/> | |
import fs = require("fs"); | |
console.log(fs.readFileSync("t.ts")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 期待する出力結果 | |
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")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 実際の出力結果 | |
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