【发布时间】:2015-08-28 14:29:57
【问题描述】:
我有 typescript 1.5.3 和 Visual Studio 2015。
我在我的打字稿中使用了外部模块,但由于以下错误,它不会构建: “构建:除非提供 '--module' 标志,否则无法编译模块。”
打字稿设置:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Any CPU'">
<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>
<TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
<TypeScriptRemoveComments>False</TypeScriptRemoveComments>
<TypeScriptOutFile />
<TypeScriptOutDir />
<TypeScriptGeneratesDeclarations>False</TypeScriptGeneratesDeclarations>
<TypeScriptNoEmitOnError>True</TypeScriptNoEmitOnError>
<TypeScriptSourceMap>True</TypeScriptSourceMap>
<TypeScriptMapRoot />
<TypeScriptSourceRoot />
模块:
export class Functions {
errorHelper(xhr: any, errorType: any, exception?: any) {
var errorMessage = exception || xhr.statusText;
alert(`Account lookup failed. ${errorMessage}`);
}
getParameterByName(name: string) {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp(`[\?&]${name}=([^&#]*)`);
var results = regex.exec(location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
}
【问题讨论】:
标签: typescript visual-studio-2015 typescript1.5