我使用最新版本在 VS2012 中创建了一个项目并添加了两个文件
// file x.ts
export class test {}
// file search.ts
import t = module('x');
问题 - 如何修复以下错误:
Error 1 ';' expected. D:\Code\Search\Search\node_modules\search\search.ts 1 18 search.ts
Error 2 Module cannot be aliased to a non-module type. D:\Code\Search\Search\node_modules\search\search.ts 1 1 search.ts
Error 3 Unable to resolve module reference 'module'. D:\Code\Search\Search\node_modules\search\search.ts 1 12 search.ts
csproj 包含以下内容:
<TypeScriptCompile Include="node_modules\search\x.ts" />
<TypeScriptCompile Include="node_modules\search\search.ts" />
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptRemoveComments>false</TypeScriptRemoveComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
</PropertyGroup>
<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" />
x.ts 编译得很好,但 search.ts 不是
define(["require", "exports"], function(require, exports) {
var test = (function () {
function test() {
}
return test;
})();
exports.test = test;
});
//# sourceMappingURL=x.js.map