2013-08-30 44 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 

回答