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