Typescript编译设置


TypeScript MSBuild编译选项,用记事本打开工程文件,进行修改,如<TypeScriptGeneratesDeclarations>true</TypeScriptGeneratesDeclarations>表示自动生成.d.ts定义文件,不用手动写.d.ts文件,多方便

在MSBuild里使用编译选项

概述

编译选项可以在使用MSBuild的项目里通过MSBuild属性指定。

例子

<PropertyGroup Condition="'$(Configuration)' == 'Debug'"> <TypeScriptRemoveComments>false</TypeScriptRemoveComments> <TypeScriptSourceMap>true</TypeScriptSourceMap> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)' == 'Release'"> <TypeScriptRemoveComments>true</TypeScriptRemoveComments> <TypeScriptSourceMap>false</TypeScriptSourceMap> </PropertyGroup> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" /> 

映射

 

编译选项 MSBuild属性名称 可用值
--declaration TypeScriptGeneratesDeclarations 布尔值
--module TypeScriptModuleKind AMDCommonJsUMD 或 System
--target TypeScriptTarget ES3ES5, or ES6
--charset TypeScriptCharset  
--emitBOM TypeScriptEmitBOM 布尔值
--emitDecoratorMetadata TypeScriptEmitDecoratorMetadata 布尔值
--experimentalDecorators TypeScriptExperimentalDecorators 布尔值
--inlineSourceMap TypeScriptInlineSourceMap 布尔值
--inlineSources TypeScriptInlineSources 布尔值
--locale 自动的 自动设置成PreferredUILang的值
--mapRoot TypeScriptMapRoot 文件路径
--newLine TypeScriptNewLine CRLF 或 LF
--noEmitOnError TypeScriptNoEmitOnError 布尔值
--noEmitHelpers TypeScriptNoEmitHelpers 布尔值
--noImplicitAny TypeScriptNoImplicitAny 布尔值
--noUnusedLocals TypeScriptNoUnusedLocals 布尔值
--noUnusedParameters TypeScriptNoUnusedParameters 布尔值
--noLib TypeScriptNoLib 布尔值
--noResolve TypeScriptNoResolve 布尔值
--out TypeScriptOutFile 文件路径
--outDir TypeScriptOutDir 文件路径
--preserveConstEnums TypeScriptPreserveConstEnums 布尔值
--removeComments TypeScriptRemoveComments 布尔值
--rootDir TypeScriptRootDir 文件路径
--isolatedModules TypeScriptIsolatedModules 布尔值
--sourceMap TypeScriptSourceMap 文件路径
--sourceRoot TypeScriptSourceRoot 文件路径
--strictNullChecks TypeScriptStrictNullChecks 布尔值
--suppressImplicitAnyIndexErrors TypeScriptSuppressImplicitAnyIndexErrors 布尔值
--suppressExcessPropertyErrors TypeScriptSuppressExcessPropertyErrors 布尔值
--moduleResolution TypeScriptModuleResolution Classic or Node
--experimentalAsyncFunctions TypeScriptExperimentalAsyncFunctions 布尔值
--jsx TypeScriptJSXEmit React or Preserve
--reactNamespace TypeScriptReactNamespace string
--skipDefaultLibCheck TypeScriptSkipDefaultLibCheck 布尔值
--allowUnusedLabels TypeScriptAllowUnusedLabels 布尔值
--noImplicitReturns TypeScriptNoImplicitReturns 布尔值
--noFallthroughCasesInSwitch TypeScriptNoFallthroughCasesInSwitch 布尔值
--allowUnreachableCode TypeScriptAllowUnreachableCode 布尔值
--forceConsistentCasingInFileNames TypeScriptForceConsistentCasingInFileNames 布尔值
--allowSyntheticDefaultImports TypeScriptAllowSyntheticDefaultImports 布尔值
--noImplicitUseStrict TypeScriptNoImplicitUseStrict 布尔值
--project VS不支持  
--watch VS不支持  
--diagnostics VS不支持  
--listFiles VS不支持  
--noEmit VS不支持  
--allowJs VS不支持  
VS特有选项 TypeScriptAdditionalFlags 任意编译选项


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM