LoginSignup
53
50

More than 5 years have passed since last update.

TypeScript1.6系のコンパイラのオプション一覧

Last updated at Posted at 2015-11-24

TypeScriptのコンパイルコマンド、tscの--helpで確認できるコマンドをまとめてみました
バージョンは1.6.2です
2系の記事もあげました。

$ tsc
Version 1.6.2
オプション 説明
-d, --declaration Generates corresponding '.d.ts' file.
対応する.d.tsファイルを生成
TypeScriptで記述したファイルから型定義ファイルを生成します
--experimentalAsyncFunctions Enables experimental support for ES7 async functions.
ES7の非同期機能(仕様未確定?)のサポートを有効化
ES7から実装されるAsync/Awaitとやらを有効にするみたいです
--experimentalDecorators Enables experimental support for ES7 decorators.
ES7から実装されるdecorators(仕様未確定?)のサポートを有効化
こちらも上記同様
-h, --help Print this message.
ヘルプ表示
--init Initializes a TypeScript project and creates a tsconfig.json file.
TypeScriptのプロジェクトを初期化し、tsconfig.jsonを作成
--jsx KIND Specify JSX code generation: 'preserve' or 'react'
jsxの変換を行う
preserveを指定するとそのままのjsxの書き方で、reactを指定するとReactのメソッドに変換されます
--mapRoot LOCATION Specifies the location where debugger should locate map files instead of generated locations.
デバッガーが参照するマップファイルの場所を指定
Chromeなどでjsをデバッグするときなどにjsから参照する.mapファイルを任意の場所を見るように変更できます
-m KIND, --module KIND Specify module code generation: 'commonjs', 'amd', 'system' or 'umd'
コード変換のモジュールの指定
モジュールの管理をcommonjsやamdなどどの形式で行うか設定できます
--moduleResolution Specifies module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6).
モジュールの解決方法の指定
--newLine NEWLINE Specifies the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).
ファイル出力のときの行末の形式の指定
ファイルを出力する際の改行コードをCRLFかLFか指定することができます
--noEmit Do not emit outputs.
ファイルを出力しない
エラーが無いか確認するため?
--noEmitOnError Do not emit outputs if any errors were reported.
エラーが合った場合ファイルを出力しない
--noImplicitAny Raise error on expressions and declarations with an implied 'any' type.
暗黙のany型の宣言をエラー表示
厳密に型を決めたいとき、anyのものは全てエラーとすることができます
--outDir DIRECTORY Redirect output structure to the directory.
ディレクトリへの出力の変更
コンパイル後に掃き出すファイルの出力先ディレクトリを任意の場所に指定することができます
--outFile FILE Concatenate and emit output to single file.
連結し、単一のファイルとして出力
FILEに指定した名前で複数の.tsファイルをひとつのファイルにまとめることができます
--preserveConstEnums Do not erase const enum declarations in generated code.
コンパイル後のコードからconst enumの宣言を消さないようにする
-p DIRECTORY, --project DIRECTORY Compile the project in the given directory.
指定されたディレクトリでプロジェクトをコンパイル
tsconfig.jsonが存在するディレクトリを指し示すことによってtsconifg.jsonの設定でコンパイルできます
--removeComments Do not emit comments to output.
出力からコメントを削除
元の.tsファイルのコメントを入れないで出力することが出来ます
--rootDir LOCATION Specifies the root directory of input files. Use to control the output directory structure with --outDir.
入力ファイルのルートディレクトリを指定、--outDirで出力場所の変更をするときに使用
--sourceMap Generates corresponding '.map' file.
関連する.mapファイルを生成
このオプションを指定するとデバッグをするときにjs側から、.mapファイルを参照し、元の.tsファイルと結びつけてくれます
--sourceRoot LOCATION Specifies the location where debugger should locate TypeScript files instead of source locations.
デバッガーが見るソースファイルの場所を指定
--suppressImplicitAnyIndexErrors Suppress noImplicitAny errors for indexing objects lacking index signatures.
インデクサアクセス時、値が見つからない時のnoImplicitAnyエラーを抑制
-t VERSION, --target VERSION Specify ECMAScript target version: 'ES3' (default), 'ES5', or 'ES6' (experimental)
コンパイル出力のECMAScriptのバージョンを指定
-v, --version Print the compiler's version.
バージョン表示
-w, --watch Watch input files.
入力ファイル監視
そのファイルを保存したときにコンパイルが走るようになります
@<file> Insert command line options and files from a file.
ファイルに記したコマンドラインオプションとファイルを挿入
細かい記述をしたものをファイルにまとめて、長いコマンドを打つことなくコンパイルしたりできます
53
50
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
53
50