Repository: karen-irc/option-t
Pull request #1062 (2021-07-02 13:44:16)

Upgrade TypeScript to v4.5


Patch:
diff --git a/package.json b/package.json
index 66b32867..416fa00b 100644
--- a/package.json
+++ b/package.json
@@ -63,7 +63,7 @@
     "eslint-config-prettier": "^8.3.0",
     "picomatch": "^2.3.0",
     "prettier": "^2.4.1",
-    "typescript": "~4.3.5"
+    "typescript": "^4.5.1-rc"
   },
   "sideEffects": false,
   "typings": "./cjs/index.d.ts"
diff --git a/tools/cp_files.mjs b/tools/cp_files.mjs
index 33b5a43d..5efb77ae 100644
--- a/tools/cp_files.mjs
+++ b/tools/cp_files.mjs
@@ -1,5 +1,5 @@
-import fs from 'node:fs/promises';
-import path from 'node:path';
+import fs from 'fs/promises';
+import path from 'path';
 
 import { getAllGlobMatchedFiles } from './glob.mjs';
 import { parseArgs } from './parse_argv.mjs';
diff --git a/tools/extension_renamer.mjs b/tools/extension_renamer.mjs
index afb5ed05..8154b5a0 100644
--- a/tools/extension_renamer.mjs
+++ b/tools/extension_renamer.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'node:assert/strict';
-import { promises as fs } from 'node:fs';
-import * as path from 'node:path';
-import { fileURLToPath } from 'node:url';
+import * as assert from 'assert';
+import { promises as fs } from 'fs';
+import * as path from 'path';
+import { fileURLToPath } from 'url';
 
 const FROM_EXTENSION = 'js';
 const TO_EXTENSION = 'mjs';
diff --git a/tools/generate_import_path_list_markdown.mjs b/tools/generate_import_path_list_markdown.mjs
index bc386bc4..4a64720d 100644
--- a/tools/generate_import_path_list_markdown.mjs
+++ b/tools/generate_import_path_list_markdown.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'node:assert/strict';
-import { promises as fs } from 'node:fs';
-import * as path from 'node:path';
-import { fileURLToPath } from 'node:url';
+import * as assert from 'assert';
+import { promises as fs } from 'fs';
+import * as path from 'path';
+import { fileURLToPath } from 'url';
 
 import {
     generateExposedPathSequence,
diff --git a/tools/glob.mjs b/tools/glob.mjs
index 76d2fa2e..ab46f6bd 100644
--- a/tools/glob.mjs
+++ b/tools/glob.mjs
@@ -1,5 +1,5 @@
-import * as fs from 'node:fs/promises';
-import * as path from 'node:path';
+import * as fs from 'fs/promises';
+import * as path from 'path';
 
 import picomatch from 'picomatch';
 
diff --git a/tools/package_json_rewriter/json.mjs b/tools/package_json_rewriter/json.mjs
index 4f120712..5a7cd603 100644
--- a/tools/package_json_rewriter/json.mjs
+++ b/tools/package_json_rewriter/json.mjs
@@ -1,5 +1,5 @@
-import { promises as fs } from 'node:fs';
-import * as path from 'node:path';
+import { promises as fs } from 'fs';
+import * as path from 'path';
 
 async function loadFileAsText(baseDir, filepath) {
     const p = path.resolve(baseDir, filepath);
diff --git a/tools/package_json_rewriter/main.mjs b/tools/package_json_rewriter/main.mjs
index 98980192..4859aebf 100644
--- a/tools/package_json_rewriter/main.mjs
+++ b/tools/package_json_rewriter/main.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'node:assert/strict';
-import { promises as fs } from 'node:fs';
-import * as path from 'node:path';
-import { fileURLToPath } from 'node:url';
+import * as assert from 'assert';
+import { promises as fs } from 'fs';
+import * as path from 'path';
+import { fileURLToPath } from 'url';
 
 import { addExportsFields } from './transformer/add_exports_field/main.mjs';
 import { loadJSON } from './json.mjs';
diff --git a/tools/package_json_rewriter/transformer/add_exports_field/ExportEntry.mjs b/tools/package_json_rewriter/transformer/add_exports_field/ExportEntry.mjs
index a382d970..0b335aa4 100644
--- a/tools/package_json_rewriter/transformer/add_exports_field/ExportEntry.mjs
+++ b/tools/package_json_rewriter/transformer/add_exports_field/ExportEntry.mjs
@@ -1,4 +1,4 @@
-import * as assert from 'node:assert/strict';
+import * as assert from 'assert';
 
 import {
     QuirksLegacyExposedPath
diff --git a/tools/package_json_rewriter/transformer/add_exports_field/compatibility.mjs b/tools/package_json_rewriter/transformer/add_exports_field/compatibility.mjs
index 0521b2d0..bc3fdb43 100644
--- a/tools/package_json_rewriter/transformer/add_exports_field/compatibility.mjs
+++ b/tools/package_json_rewriter/transformer/add_exports_field/compatibility.mjs
@@ -1,4 +1,4 @@
-import * as assert from 'node:assert/strict';
+import * as assert from 'assert';
 
 import {
     CompatExportEntry,
diff --git a/tools/package_json_rewriter/transformer/add_exports_field/public_api.mjs b/tools/package_json_rewriter/transformer/add_exports_field/public_api.mjs
index ad784113..c36a65cb 100644
--- a/tools/package_json_rewriter/transformer/add_exports_field/public_api.mjs
+++ b/tools/package_json_rewriter/transformer/add_exports_field/public_api.mjs
@@ -1,4 +1,4 @@
-import * as assert from 'node:assert/strict';
+import * as assert from 'assert';
 
 import { ExportEntry } from './ExportEntry.mjs';
 
diff --git a/tools/parse_argv.mjs b/tools/parse_argv.mjs
index 61261f7b..01c8e80f 100644
--- a/tools/parse_argv.mjs
+++ b/tools/parse_argv.mjs
@@ -1,4 +1,4 @@
-import * as assert from 'node:assert/strict';
+import * as assert from 'assert';
 
 function isFlagKey(str) {
     return str.startsWith('--');
diff --git a/tsconfig.base.json b/tsconfig.base.json
index 53deae58..8a58f486 100644
--- a/tsconfig.base.json
+++ b/tsconfig.base.json
@@ -45,6 +45,8 @@
         "noUncheckedIndexedAccess": true,            /* Include 'undefined' in index signature results */
         "noPropertyAccessFromIndexSignature": true,  /* Require undeclared properties from index signatures to use element accesses. */
         "noImplicitOverride": true,
+        "exactOptionalPropertyTypes": true,
+        "useUnknownInCatchVariables": true,
 
         /* Module Resolution Options */
         "moduleResolution": "node",                  /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
diff --git a/yarn.lock b/yarn.lock
index 339f83c1..92a7d9f1 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3070,10 +3070,10 @@ typedarray-to-buffer@^3.1.5:
   dependencies:
     is-typedarray "^1.0.0"
 
-typescript@~4.3.5:
-  version "4.3.5"
-  resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
-  integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
+typescript@^4.5.1-rc:
+  version "4.5.1-rc"
+  resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.5.1-rc.tgz#02155eaa0579d11babb2a55dcbd796948a994bb3"
+  integrity sha512-tQBWW1DCFqweyhSzsAUSFgssJ3uuRBh0zyOkRV4CaFF2rMBkGU0I+MqPMch0qhGCUGXjOW7FgMrbQLS6PE3Z6Q==
 
 unicode-canonical-property-names-ecmascript@^2.0.0:
   version "2.0.0"


Test patch:
diff --git a/tools/test_esmodule_path_rewrite.mjs b/tools/test_esmodule_path_rewrite.mjs
index 7ee320a5..74e61baf 100644
--- a/tools/test_esmodule_path_rewrite.mjs
+++ b/tools/test_esmodule_path_rewrite.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'node:assert/strict';
-import { promises as fs } from 'node:fs';
-import * as path from 'node:path';
-import { fileURLToPath } from 'node:url';
+import * as assert from 'assert';
+import { promises as fs } from 'fs';
+import * as path from 'path';
+import { fileURLToPath } from 'url';
 
 const THIS_FILENAME = fileURLToPath(import.meta.url);
 const THIS_DIRNAME = path.dirname(THIS_FILENAME);
diff --git a/tools/test_package_contains_expected_all.mjs b/tools/test_package_contains_expected_all.mjs
index 7da662aa..cb954bb7 100644
--- a/tools/test_package_contains_expected_all.mjs
+++ b/tools/test_package_contains_expected_all.mjs
@@ -1,7 +1,7 @@
-import * as assert from 'node:assert/strict';
-import { promises as fs } from 'node:fs';
-import * as path from 'node:path';
-import { fileURLToPath } from 'node:url';
+import * as assert from 'assert';
+import { promises as fs } from 'fs';
+import * as path from 'path';
+import { fileURLToPath } from 'url';
 
 const THIS_FILENAME = fileURLToPath(import.meta.url);
 const THIS_DIRNAME = path.dirname(THIS_FILENAME);
diff --git a/tools/test_package_exports.mjs b/tools/test_package_exports.mjs
index ebc10838..10f5b855 100644
--- a/tools/test_package_exports.mjs
+++ b/tools/test_package_exports.mjs
@@ -1,5 +1,5 @@
-import * as assert from 'node:assert/strict';
-import { createRequire } from 'node:module';
+import * as assert from 'assert';
+import { createRequire } from 'module';
 
 import {
     generateAllExposedPathSequence,