What are the TypeScript project build configuratio

2020-02-11 09:55发布

问题:

When I create a new "HTMLWeb App" project, I get a .csproj with a few default options in the project XML for Typescript. Where can I find a list of all possible TypeScript build options?

Searching for the names of the 3 options currently in my project, such as "TypeScriptIncludeComments", returned no results on Google.

回答1:

I found the list of options in the .targets file that shipped with the TypeScript installation. Here is the full list of options with the command line argument that gets actually sent to "tsc.exe" (the TypeScript compiler)

  • TypeScriptIncludeComments ..... --comments
  • TypeScriptGeneratesDeclarations ..... --declaration
  • TypeScriptModuleKind ..... --module $(TypeScriptModuleKind)
  • TypeScriptIncludeDefaultLib ..... --nolib
  • TypeScriptOutFile ..... --out $(TypeScriptOutFile)
  • TypeScriptSourceMap ..... --sourcemap
  • TypeScriptTarget ..... --target $(TypeScriptTarget)
  • TypeScriptAdditionalFlags ..... $(TypeScriptAdditionalFlags)


回答2:

Update on Guptas's answer for Visual Studio 2015 RC. The Microsoft.TypeScript.targets file is now in c:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript.

  • TypeScriptRemoveComments ..... --removeComments
  • TypeScriptNoImplicitAny ..... --noImplicitAny
  • TypeScriptGeneratesDeclarations ..... --declaration
  • TypeScriptModuleKind ..... --module "$(TypeScriptModuleKind)"
  • TypeScriptOutFile ..... --out "$(TypeScriptOutFile)"
  • TypeScriptOutDir ..... --outDir "$(TypeScriptOutDir)"
  • TypeScriptSourceMap ..... --sourcemap
  • TypeScriptTarget ..... --target $(TypeScriptTarget)
  • TypeScriptNoResolve ..... --noResolve
  • TypeScriptAdditionalFlags ..... $(TypeScriptAdditionalFlags)
  • TypeScriptMapRoot ..... --mapRoot "$(TypeScriptMapRoot)"
  • TypeScriptSourceRoot ..... --sourceRoot "$(TypeScriptSourceRoot)"
  • TypeScriptCodePage ..... --codepage $(TypeScriptCodePage)
  • TypeScriptCharset ..... --charset $(TypeScriptCharset)
  • TypeScriptEmitBOM ..... --emitBOM
  • TypeScriptNoLib ..... --noLib
  • TypeScriptPreserveConstEnums ..... --preserveConstEnums
  • TypeScriptSuppressImplicitAnyIndexErrors ..... --suppressImplicitAnyIndexErrors


回答3:

The easiest way to change any Typescript build options is with Web Extensions. I'd highly recommend it if you do any kind of web work with Visual Studio.