From 7398f8c0d9c6c1bd19803c8b16db468d339abd97 Mon Sep 17 00:00:00 2001 From: Rob Giseburt Date: Wed, 28 Feb 2024 10:15:10 -0600 Subject: [PATCH] chore(tsconfig): support three missing strict tsconfig `compilerOptions` This was found when applying [@tsconfig/strictest](https://github.com/tsconfig/bases?tab=readme-ov-file#strictest-tsconfigjson) and working around TypeStrong/ts-node#1958 (merged, but not yet released) --- src/javascript/typescript-config.ts | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/javascript/typescript-config.ts b/src/javascript/typescript-config.ts index 2bd3c381eee..10a91ed2e19 100644 --- a/src/javascript/typescript-config.ts +++ b/src/javascript/typescript-config.ts @@ -565,6 +565,57 @@ export interface TypeScriptCompilerOptions { * You can read more about composite projects in the handbook. */ readonly tsBuildInfoFile?: string; + + /** + * Allow Unused Labels + * + * When: + * + * - `undefined` (default) provide suggestions as warnings to editors + * - `true` unused labels are ignored + * - `false` raises compiler errors about unused labels + * + * Labels are very rare in JavaScript and typically indicate an attempt to write an object literal: + * + * ```ts + * function verifyAge(age: number) { + * // Forgot 'return' statement + * if (age > 18) { + * verified: true; + * // ^^^^^^^^ Unused label. + * } + * } + * ``` + * + * @see https://www.typescriptlang.org/tsconfig#allowUnusedLabels + */ + readonly allowUnusedLabels: false; + + /** + * Allow Unreachable Code + * + * When: + * + * - `undefined` (default) provide suggestions as warnings to editors + * - `true` unreachable code is ignored + * - `false` raises compiler errors about unreachable code + * + * These warnings are only about code which is provably unreachable due to the use of JavaScript syntax. + * + * @see https://www.typescriptlang.org/tsconfig#allowUnreachableCode + */ + readonly allowUnreachableCode: false; + + /** + * Check JS + * + * Works in tandem with [allowJs](https://www.typescriptlang.org/tsconfig#allowJs). When checkJs is enabled then + * errors are reported in JavaScript files. This is the equivalent of including // @ts-check at the top of all + * JavaScript files which are included in your project. + * + * @see https://www.typescriptlang.org/tsconfig#checkJs + */ + readonly checkJs: true; } /**