From 9c294dc74cbd8abfa6229e90e33149c79ee39823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20B=C3=B6hm?= <188768+fb55@users.noreply.github.com> Date: Sun, 10 Apr 2022 14:29:43 +0100 Subject: [PATCH] refactor(tsconfig): Configure TS to be stricter (#787) --- scripts/trie/decode-trie.ts | 7 ------- scripts/trie/encode-trie.ts | 2 +- tsconfig.json | 34 +++++++++++++++++++--------------- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/scripts/trie/decode-trie.ts b/scripts/trie/decode-trie.ts index ccf6b0c6..5d5cc652 100644 --- a/scripts/trie/decode-trie.ts +++ b/scripts/trie/decode-trie.ts @@ -51,8 +51,6 @@ export function decodeNode( if (val !== -1) { const code = jumpOffset + i; - console.log("CODE", String.fromCharCode(code), i, val); - decodeNode( decodeMap, resultMap, @@ -63,11 +61,6 @@ export function decodeNode( } } else { for (let i = 0; i < branchLength; i++) { - console.log( - "BRANCH", - String.fromCharCode(decodeMap[branchIdx + i]) - ); - decodeNode( decodeMap, resultMap, diff --git a/scripts/trie/encode-trie.ts b/scripts/trie/encode-trie.ts index 3ef2d4d6..4a825143 100644 --- a/scripts/trie/encode-trie.ts +++ b/scripts/trie/encode-trie.ts @@ -1,5 +1,5 @@ import * as assert from "assert"; -import { TrieNode } from "./trie.js"; +import type { TrieNode } from "./trie.js"; function binaryLength(num: number) { return Math.ceil(Math.log2(num)); diff --git a/tsconfig.json b/tsconfig.json index 3013032f..045b82d5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,27 +1,31 @@ { "compilerOptions": { /* Basic Options */ - "target": "es5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */, - "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */, - // "lib": [], /* Specify library files to be included in the compilation. */ - "declaration": true /* Generates corresponding '.d.ts' file. */, - "declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */, - "sourceMap": true /* Generates corresponding '.map' file. */, - "outDir": "lib" /* Redirect output structure to the directory. */, - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + "target": "es5", + "module": "commonjs", + "lib": ["ES2015.Core"], + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "lib", /* Strict Type-Checking Options */ - "strict": true /* Enable all strict type-checking options. */, + "strict": true, /* 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. */, + "exactOptionalPropertyTypes": true, + "forceConsistentCasingInFileNames": true, + "importsNotUsedAsValues": "error", + "isolatedModules": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "noImplicitReturns": true, + "noPropertyAccessFromIndexSignature": true, + "noUnusedLocals": true, + "noUnusedParameters": true, /* Module Resolution Options */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, + "esModuleInterop": true, "moduleResolution": "node", "resolveJsonModule": true },