LoginSignup
10
7

More than 3 years have passed since last update.

初期化直後のtsconfig.jsonを翻訳してみた

Posted at

初期化直後の状態のtsconfig.jsonにはいくつかのデフォルト設定が記載されている。それを翻訳(直訳)しただけ。
詳細は公式ドキュメントを参照(https://www.typescriptlang.org/docs/handbook/tsconfig-json.html)。

翻訳前

{
  "compilerOptions": {
    /* Visit https://aka.ms/tsconfig.json to read more about this file */

    /* Basic Options */
    // "incremental": true,                   /* Enable incremental compilation */
    "target": "es5",                          /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
    "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
    // "lib": [],                             /* Specify library files to be included in the compilation. */
    // "allowJs": true,                       /* Allow javascript files to be compiled. */
    // "checkJs": true,                       /* Report errors in .js files. */
    // "jsx": "preserve",                     /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
    // "declaration": true,                   /* Generates corresponding '.d.ts' file. */
    // "declarationMap": true,                /* Generates a sourcemap for each corresponding '.d.ts' file. */
    // "sourceMap": true,                     /* Generates corresponding '.map' file. */
    // "outFile": "./",                       /* Concatenate and emit output to single file. */
    // "outDir": "./",                        /* Redirect output structure to the directory. */
    // "rootDir": "./",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
    // "composite": true,                     /* Enable project compilation */
    // "tsBuildInfoFile": "./",               /* Specify file to store incremental compilation information */
    // "removeComments": true,                /* Do not emit comments to output. */
    // "noEmit": true,                        /* Do not emit outputs. */
    // "importHelpers": true,                 /* Import emit helpers from 'tslib'. */
    // "downlevelIteration": true,            /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
    // "isolatedModules": true,               /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */

    /* Strict Type-Checking Options */
    "strict": true,                           /* Enable all strict type-checking options. */
    // "noImplicitAny": true,                 /* Raise error on expressions and declarations with an implied 'any' type. */
    // "strictNullChecks": true,              /* Enable strict null checks. */
    // "strictFunctionTypes": true,           /* Enable strict checking of function types. */
    // "strictBindCallApply": true,           /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
    // "strictPropertyInitialization": true,  /* Enable strict checking of property initialization in classes. */
    // "noImplicitThis": true,                /* Raise error on 'this' expressions with an implied 'any' type. */
    // "alwaysStrict": true,                  /* Parse in strict mode and emit "use strict" for each source file. */

    /* Additional Checks */
    // "noUnusedLocals": true,                /* Report errors on unused locals. */
    // "noUnusedParameters": true,            /* Report errors on unused parameters. */
    // "noImplicitReturns": true,             /* Report error when not all code paths in function return a value. */
    // "noFallthroughCasesInSwitch": true,    /* Report errors for fallthrough cases in switch statement. */

    /* Module Resolution Options */
    // "moduleResolution": "node",            /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
    // "baseUrl": "./",                       /* Base directory to resolve non-absolute module names. */
    // "paths": {},                           /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
    // "rootDirs": [],                        /* List of root folders whose combined content represents the structure of the project at runtime. */
    // "typeRoots": [],                       /* List of folders to include type definitions from. */
    // "types": [],                           /* Type declaration files to be included in compilation. */
    // "allowSyntheticDefaultImports": true,  /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
    "esModuleInterop": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
    // "preserveSymlinks": true,              /* Do not resolve the real path of symlinks. */
    // "allowUmdGlobalAccess": true,          /* Allow accessing UMD globals from modules. */

    /* Source Map Options */
    // "sourceRoot": "",                      /* Specify the location where debugger should locate TypeScript files instead of source locations. */
    // "mapRoot": "",                         /* Specify the location where debugger should locate map files instead of generated locations. */
    // "inlineSourceMap": true,               /* Emit a single file with source maps instead of having a separate file. */
    // "inlineSources": true,                 /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */

    /* Experimental Options */
    // "experimentalDecorators": true,        /* Enables experimental support for ES7 decorators. */
    // "emitDecoratorMetadata": true,         /* Enables experimental support for emitting type metadata for decorators. */

    /* Advanced Options */
    "skipLibCheck": true,                     /* Skip type checking of declaration files. */
    "forceConsistentCasingInFileNames": true  /* Disallow inconsistently-cased references to the same file. */
  }
}

翻訳後

{
  "compilerOptions": {
    /* Visit https://aka.ms/tsconfig.json to read more about this file */

    /* Basic Options */                       /* 基本オプション */
    // "incremental": true,                   /* インクリメンタルコンパイルを有効にする */
    "target": "es5",                          /* ECMAScriptのターゲットバージョンを指定する:'ES3'(デフォルト)、'ES5'、'ES2015'、'ES2016'、'ES2017'、'ES2018'、'ES2019'、'ES2020'、または'ESNEXT'。 */
    "module": "commonjs",                     /* モジュールコードの生成を指定します:'none'、'commonjs'、'amd'、'system'、'umd'、'es2015'、'es2020'、または'esNext'。 */
    // "lib": [],                             /* コンパイルに含めるライブラリファイルを指定します。 */
    // "allowJs": true,                       /* javascriptファイルのコンパイルを許可します。<-javascriptもtypescriptによってコンパイルされる。 */
    // "checkJs": true,                       /* .js ファイルのエラーを報告する。<-javascriptファイルのコードチェックのみで、コンパイルはされない。 */
    // "jsx": "preserve",                     /* JSX コードの生成方法を指定します: 'preserve'、'react-native'、または 'react'。<-Reactを使う際に必要なオプション。 */
    // "declaration": true,                   /* 対応する '.d.ts' ファイルを生成します。<-プロジェクトをライブラリとして公開したいときに必要になる設定。 */
    // "declarationMap": true,                /* 対応する'.d.ts'ファイルごとにソースマップを生成します。<-プロジェクトをライブラリとして公開したいときに必要になる設定。 */
    // "sourceMap": true,                     /* 対応する'.map'ファイルを生成する。<-Chromeのコンソールの「Source」にTSファイルも表示されるようになり、typescriptファイル上でブレークポイントを使ったデバックが可能になる */
    // "outFile": "./",                       /* 出力を一つのファイルに連結して出力する。<-javascriptファイルを一つにまとめて出力するオプション */
    // "outDir": "./",                        /* 出力構造体をディレクトリにリダイレクトする。<-コンパイルされたjavascriptファイルの出力先。 */
    // "rootDir": "./",                       /* 入力ファイルのルートディレクトリを指定します。outDirで出力ディレクトリ構造を制御します。<-コンパイル元のtypescriptファイルがあるフォルダ */
    // "composite": true,                     /* プロジェクトのコンパイルを有効にする */
    // "tsBuildInfoFile": "./",               /* インクリメンタルコンパイル情報を格納するファイルを指定 */
    // "removeComments": true,                /* 出力にコメントを出力しない。<-typescriptファイルでのコメントがコンパイル後のjavascriptファイルでは削除される設定。 */
    // "noEmit": true,                        /* 出力しないでください。<-コンパイルしてもjavascriptファイルは生成されない。typescriptのコードチェックのみしてくれる */
    // "importHelpers": true,                 /* エミットヘルパーを 'tslib' からインポート。 */
    // "downlevelIteration": true,            /* 'ES5' または 'ES3' をターゲットとした場合に、'for-of'、'splad'、および 'destructuring' でのイテレート可能性を完全にサポート。<-古いバージョンのjavascriptを対象にコンパイルした場合、forループが正常に動作しない時に設定 */
    // "isolatedModules": true,               /* 各ファイルを個別のモジュールとしてトランスパイルするようにしました (ts.transpileModule に似ています)。 */

    /* Strict Type-Checking Options */        /* 厳格なタイプチェックオプション */
    "strict": true,                           /* すべての厳密な型チェックオプションを有効にしました。<-以下7つのオプションが有効になる 特定の設定だけ使いたい場合は各自で設定する */
    // "noImplicitAny": true,                 /* any' 型が暗黙的に指定されている式や宣言に対してエラーを発生させるようにしました。 */
    // "strictNullChecks": true,              /* 厳格なヌルチェックを有効にします。<-nullかもしれないオブジェクトへのアクセス時のチェック。 */
    // "strictFunctionTypes": true,           /* 関数型の厳密なチェックを有効にします。<-パラメータや戻り値に対するチェック、クラスや継承の時に発生しうるエラーをチェックできる */
    // "strictBindCallApply": true,           /* 関数の 'bind'、'call'、および 'apply' メソッドの厳密なチェックを有効にします。<-Bind,Call,Applyを使う時に引数が正しいものかチェック */
    // "strictPropertyInitialization": true,  /* クラスのプロパティ初期化の厳密なチェックを有効にしました。 */
    // "noImplicitThis": true,                /* any' 型が暗黙的に指定されている 'this' 式に対してエラーを発生させます。 */
    // "alwaysStrict": true,                  /* 厳密モードでパースし、各ソースファイルに対して "use strict" を発行するようになりました。 */

    /* Additional Checks */                   /* 追加チェック */
    // "noUnusedLocals": true,                /* 未使用のローカルでエラーを報告するようになりました。<-利用されないローカル変数を許可しない。 */
    // "noUnusedParameters": true,            /* 未使用のパラメータでエラーを報告するようにしました。<-関数の引数に利用されないパラメータの存在を許可しない。 */
    // "noImplicitReturns": true,             /* 関数内のすべてのコードパスが値を返すわけではない場合のエラーを報告するようにしました。<-関数内で分岐がある場合、すべてのケースでreturnを行わなければならない設定。 */
    // "noFallthroughCasesInSwitch": true,    /* switch文でフォールスルーの場合のエラーを報告するようにした。<-breakせずに次の処理の実行を拒否。 */

    /* Module Resolution Options */           /* モジュールの解像度オプション */
    // "moduleResolution": "node",            /* モジュールの解決方法を 'node' (Node.js) または 'classic' (TypeScript pre-1.6) で指定できるようになりました。 */
    // "baseUrl": "./",                       /* 非絶対的なモジュール名を解決するためのベースディレクトリ。 */
    // "paths": {},                           /* インポートを 'baseUrl' からの相対的な検索場所に再マップする一連のエントリ。 */
    // "rootDirs": [],                        /* 実行時のプロジェクトの構造を表すルートフォルダのリスト。 */
    // "typeRoots": [],                       /* 型定義を含めるフォルダのリスト。 */
    // "types": [],                           /* コンパイル時に含める型宣言ファイルのリスト */
    // "allowSyntheticDefaultImports": true,  /* デフォルトのエクスポートがないモジュールからのデフォルトのインポートを許可する。これはコードのエミットには影響しません。 */
    "esModuleInterop": true,                  /* すべてのインポートに名前空間オブジェクトを作成することで、CommonJSとESモジュール間のエミットの相互運用性を可能にします。allowSyntheticDefaultImports'をインプリメントします。 */
    // "preserveSymlinks": true,              /* シンボリックリンクの実パスを解決しない。 */
    // "allowUmdGlobalAccess": true,          /* モジュールからの UMD グローバルへのアクセスを許可する。 */

    /* Source Map Options */                  /* ソースマップオプション */
    // "sourceRoot": "",                      /* デバッガーがソースの場所ではなく、TypeScript ファイルを見つける場所を指定します。 */
    // "mapRoot": "",                         /* デバッガーが生成された場所の代わりにマップファイルを配置する場所を指定する。 */
    // "inlineSourceMap": true,               /* 別々のファイルを持つのではなく、ソースマップと一緒に単一のファイルを送信する。 */
    // "inlineSources": true,                 /* 1 つのファイル内でソースマップと一緒にソースを出力します。 */

    /* Experimental Options */                /* 実験オプション<-将来的にjavascriptの機能として取り込まれるかは不明 */
    // "experimentalDecorators": true,        /* ES7 デコレータを実験的にサポートします。 */
    // "emitDecoratorMetadata": true,         /* デコレータのための型メタデータの出力を実験的にサポートします。 */

    /* Advanced Options */                    /* 高度なオプション */
    "skipLibCheck": true,                     /* 宣言ファイルの型チェックをスキップできるようになりました。 */
    "forceConsistentCasingInFileNames": true  /* 同一ファイルへの矛盾した大文字小文字の参照を許可しないようにしました。 */
  }
}

個人的に入れておきたい設定

"noEmitOnError": true,  /* typescriptコンパイルエラーになる場合、javascriptファイルを出力しない設定 */
10
7
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
10
7