作者回复: 看看 index.html 中是否正确引入
作者回复: 编译结果看,没有区别,这个语法用得很少
作者回复: 检查一下编译后的文件: 1) var Shape; (function (Shape) { function square(x) { return x * x; } Shape.square = square; })(Shape || (Shape = {})); 2) /// <reference path="./nameSpace2.ts" /> var Shape; (function (Shape) { var pi = Math.PI; function cricle(r) { return pi * Math.pow(r, 2); } Shape.cricle = cricle; })(Shape || (Shape = {})); console.log(Shape); 以及在index.html中是否把两个编译后的js都引入了。