2013-08-30 161 views
2

我創建使用最新版本在VS2012的項目,並增加了兩個文件打字稿AMD模塊不能編譯

// 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 

回答