From 43d26f6e0f3f2adcf7d273b657b4a9fc343daaf3 Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Mon, 14 Oct 2024 14:32:58 +0200 Subject: [PATCH] Update typescript --- package.json | 2 +- packages/api/tsconfig.build.json | 4 ---- packages/api/tsconfig.json | 1 - .../beacon-node/src/eth1/eth1DepositDataTracker.ts | 2 +- packages/beacon-node/tsconfig.build.json | 7 +------ packages/beacon-node/tsconfig.json | 5 +---- packages/cli/tsconfig.build.json | 7 +------ packages/cli/tsconfig.json | 5 +---- packages/config/tsconfig.build.json | 6 +----- packages/config/tsconfig.json | 1 - packages/db/tsconfig.build.json | 6 +----- packages/db/tsconfig.json | 3 +-- packages/flare/tsconfig.build.json | 6 +----- packages/flare/tsconfig.json | 3 +-- packages/fork-choice/tsconfig.build.json | 6 +----- packages/fork-choice/tsconfig.json | 3 +-- packages/light-client/tsconfig.build.json | 6 +----- packages/light-client/tsconfig.json | 3 +-- packages/logger/tsconfig.build.json | 6 +----- packages/logger/tsconfig.json | 3 +-- packages/params/tsconfig.build.json | 6 +----- packages/params/tsconfig.json | 3 +-- packages/prover/tsconfig.build.json | 2 -- tsconfig.build.json | 6 ++++++ tsconfig.json | 11 ++++++++--- yarn.lock | 13 +++++++++---- 26 files changed, 42 insertions(+), 84 deletions(-) diff --git a/package.json b/package.json index e6de076cf494..5827142cccb9 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "stream-http": "^3.2.0", "supertest": "^6.3.3", "ts-node": "^10.9.2", - "typescript": "^5.4.2", + "typescript": "^5.6.3", "typescript-docs-verifier": "^2.5.0", "vite": "^5.3.4", "vite-plugin-dts": "^3.9.1", diff --git a/packages/api/tsconfig.build.json b/packages/api/tsconfig.build.json index 92235557ba5d..46fbf2880f1d 100644 --- a/packages/api/tsconfig.build.json +++ b/packages/api/tsconfig.build.json @@ -1,7 +1,3 @@ { "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib" - } } diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index b29a7b46c4b1..6f83eb665f83 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -1,4 +1,3 @@ { "extends": "../../tsconfig.json", - "compilerOptions": {} } diff --git a/packages/beacon-node/src/eth1/eth1DepositDataTracker.ts b/packages/beacon-node/src/eth1/eth1DepositDataTracker.ts index a38b3f9987d9..5c678bf48c2e 100644 --- a/packages/beacon-node/src/eth1/eth1DepositDataTracker.ts +++ b/packages/beacon-node/src/eth1/eth1DepositDataTracker.ts @@ -225,7 +225,7 @@ export class Eth1DepositDataTracker { // If remoteFollowBlock is not at or beyond deployBlock, there is no need to // fetch and track any deposit data yet - if (remoteFollowBlock < this.eth1Provider.deployBlock ?? 0) return true; + if (remoteFollowBlock < (this.eth1Provider.deployBlock ?? 0)) return true; const hasCaughtUpDeposits = await this.updateDepositCache(remoteFollowBlock); const hasCaughtUpBlocks = await this.updateBlockCache(remoteFollowBlock); diff --git a/packages/beacon-node/tsconfig.build.json b/packages/beacon-node/tsconfig.build.json index b46adfa48cb7..77cad4f9bb37 100644 --- a/packages/beacon-node/tsconfig.build.json +++ b/packages/beacon-node/tsconfig.build.json @@ -1,8 +1,3 @@ { - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib", - "typeRoots": ["../../node_modules/@types", "./node_modules/@types", "../../types"] - } + "extends": "../../tsconfig.build.json" } diff --git a/packages/beacon-node/tsconfig.json b/packages/beacon-node/tsconfig.json index 3495a93b11f7..ca426e42bf85 100644 --- a/packages/beacon-node/tsconfig.json +++ b/packages/beacon-node/tsconfig.json @@ -1,7 +1,4 @@ { "extends": "../../tsconfig.json", - "exclude": ["../../node_modules/it-pipe"], - "compilerOptions": { - "typeRoots": ["../../node_modules/@types", "../../types"] - } + "exclude": ["../../node_modules/it-pipe"] } diff --git a/packages/cli/tsconfig.build.json b/packages/cli/tsconfig.build.json index b46adfa48cb7..77cad4f9bb37 100644 --- a/packages/cli/tsconfig.build.json +++ b/packages/cli/tsconfig.build.json @@ -1,8 +1,3 @@ { - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib", - "typeRoots": ["../../node_modules/@types", "./node_modules/@types", "../../types"] - } + "extends": "../../tsconfig.build.json" } diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index f81823701532..4082f16a5d91 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -1,6 +1,3 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": { - "typeRoots": ["../../node_modules/@types", "./node_modules/@types", "../../types"] - } + "extends": "../../tsconfig.json" } diff --git a/packages/config/tsconfig.build.json b/packages/config/tsconfig.build.json index 92235557ba5d..77cad4f9bb37 100644 --- a/packages/config/tsconfig.build.json +++ b/packages/config/tsconfig.build.json @@ -1,7 +1,3 @@ { - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib" - } + "extends": "../../tsconfig.build.json" } diff --git a/packages/config/tsconfig.json b/packages/config/tsconfig.json index b29a7b46c4b1..6f83eb665f83 100644 --- a/packages/config/tsconfig.json +++ b/packages/config/tsconfig.json @@ -1,4 +1,3 @@ { "extends": "../../tsconfig.json", - "compilerOptions": {} } diff --git a/packages/db/tsconfig.build.json b/packages/db/tsconfig.build.json index 92235557ba5d..77cad4f9bb37 100644 --- a/packages/db/tsconfig.build.json +++ b/packages/db/tsconfig.build.json @@ -1,7 +1,3 @@ { - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib" - } + "extends": "../../tsconfig.build.json" } diff --git a/packages/db/tsconfig.json b/packages/db/tsconfig.json index b29a7b46c4b1..4082f16a5d91 100644 --- a/packages/db/tsconfig.json +++ b/packages/db/tsconfig.json @@ -1,4 +1,3 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": {} + "extends": "../../tsconfig.json" } diff --git a/packages/flare/tsconfig.build.json b/packages/flare/tsconfig.build.json index 92235557ba5d..77cad4f9bb37 100644 --- a/packages/flare/tsconfig.build.json +++ b/packages/flare/tsconfig.build.json @@ -1,7 +1,3 @@ { - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib" - } + "extends": "../../tsconfig.build.json" } diff --git a/packages/flare/tsconfig.json b/packages/flare/tsconfig.json index b29a7b46c4b1..4082f16a5d91 100644 --- a/packages/flare/tsconfig.json +++ b/packages/flare/tsconfig.json @@ -1,4 +1,3 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": {} + "extends": "../../tsconfig.json" } diff --git a/packages/fork-choice/tsconfig.build.json b/packages/fork-choice/tsconfig.build.json index 92235557ba5d..77cad4f9bb37 100644 --- a/packages/fork-choice/tsconfig.build.json +++ b/packages/fork-choice/tsconfig.build.json @@ -1,7 +1,3 @@ { - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib" - } + "extends": "../../tsconfig.build.json" } diff --git a/packages/fork-choice/tsconfig.json b/packages/fork-choice/tsconfig.json index b29a7b46c4b1..4082f16a5d91 100644 --- a/packages/fork-choice/tsconfig.json +++ b/packages/fork-choice/tsconfig.json @@ -1,4 +1,3 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": {} + "extends": "../../tsconfig.json" } diff --git a/packages/light-client/tsconfig.build.json b/packages/light-client/tsconfig.build.json index 92235557ba5d..77cad4f9bb37 100644 --- a/packages/light-client/tsconfig.build.json +++ b/packages/light-client/tsconfig.build.json @@ -1,7 +1,3 @@ { - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "lib" - } + "extends": "../../tsconfig.build.json" } diff --git a/packages/light-client/tsconfig.json b/packages/light-client/tsconfig.json index 63a72e23786c..2e29400b48af 100644 --- a/packages/light-client/tsconfig.json +++ b/packages/light-client/tsconfig.json @@ -1,5 +1,4 @@ { "extends": "../../tsconfig.json", - "exclude": ["src/index.browser.ts", "test/unit/webEsmBundle.browser.test.ts"], - "compilerOptions": {} + "exclude": ["src/index.browser.ts", "test/unit/webEsmBundle.browser.test.ts"] } diff --git a/packages/logger/tsconfig.build.json b/packages/logger/tsconfig.build.json index bac394399f4e..77cad4f9bb37 100644 --- a/packages/logger/tsconfig.build.json +++ b/packages/logger/tsconfig.build.json @@ -1,7 +1,3 @@ { - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "./lib" - } + "extends": "../../tsconfig.build.json" } diff --git a/packages/logger/tsconfig.json b/packages/logger/tsconfig.json index b29a7b46c4b1..4082f16a5d91 100644 --- a/packages/logger/tsconfig.json +++ b/packages/logger/tsconfig.json @@ -1,4 +1,3 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": {} + "extends": "../../tsconfig.json" } diff --git a/packages/params/tsconfig.build.json b/packages/params/tsconfig.build.json index bac394399f4e..77cad4f9bb37 100644 --- a/packages/params/tsconfig.build.json +++ b/packages/params/tsconfig.build.json @@ -1,7 +1,3 @@ { - "extends": "../../tsconfig.build.json", - "include": ["src"], - "compilerOptions": { - "outDir": "./lib" - } + "extends": "../../tsconfig.build.json" } diff --git a/packages/params/tsconfig.json b/packages/params/tsconfig.json index b29a7b46c4b1..4082f16a5d91 100644 --- a/packages/params/tsconfig.json +++ b/packages/params/tsconfig.json @@ -1,4 +1,3 @@ { - "extends": "../../tsconfig.json", - "compilerOptions": {} + "extends": "../../tsconfig.json" } diff --git a/packages/prover/tsconfig.build.json b/packages/prover/tsconfig.build.json index ded740172893..8f20ba957c3d 100644 --- a/packages/prover/tsconfig.build.json +++ b/packages/prover/tsconfig.build.json @@ -1,8 +1,6 @@ { "extends": "../../tsconfig.build.json", - "include": ["src"], "compilerOptions": { - "outDir": "lib", // Had to add it because compiling error `Duplicate identifier 'Buffer'` "skipLibCheck": true } diff --git a/tsconfig.build.json b/tsconfig.build.json index 8034a32ce679..8266b67f64d0 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -1,4 +1,5 @@ { + "include": ["${configDir}/src"], "compilerOptions": { "target": "es2021", "lib": ["es2021", "dom"], @@ -24,9 +25,14 @@ "declarationMap": true, "incremental": true, "preserveWatchOutput": true, + "noUncheckedSideEffectImports": true, + "noCheck": true, // TODO: Investigate following errors: // - Cannot find module 'rollup/parseAst' or its corresponding type declarations "skipLibCheck": true, + + // Output relative to each package + "outDir": "${configDir}/lib" } } diff --git a/tsconfig.json b/tsconfig.json index c2cf3e5f258a..cf158e6de36d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,11 +4,16 @@ "emitDeclarationOnly": false, "incremental": false, // Required to run benchmark command from root directory - "typeRoots": ["node_modules/@types", "./types"], + "typeRoots": [ + "node_modules/@types", + "./types", + "${configDir}/node_modules/@types", + "${configDir}/types" + ], + "noCheck": false, "noEmit": true, // To be used in the test fixtures "resolveJsonModule": true, - // We want to speed up the CI run for all tests, which require us to use the // `transpileOnly` mode for the `ts-node`. This change requires to treat types for each module // independently, which is done by setting the `isolatedModules` flag to `true`. @@ -17,4 +22,4 @@ "ts-node": { "transpileOnly": true } -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 32c923a514e9..c57a863c6e1d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3315,9 +3315,9 @@ undici-types "~5.26.4" "@types/node@^20.12.8": - version "20.16.7" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.7.tgz#0a245bf5805add998a22b8b5adac612ee70190bc" - integrity sha512-QkDQjAY3gkvJNcZOWwzy3BN34RweT0OQ9zJyvLCU0kSK22dO2QYh/NHGfbEAYylPYzRB1/iXcojS79wOg5gFSw== + version "20.16.11" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.11.tgz#9b544c3e716b1577ac12e70f9145193f32750b33" + integrity sha512-y+cTCACu92FyA5fgQSAI8A1H429g7aSK2HsO7K4XYUWc4dY5IUz55JSDIYT6/VsOLfGy8vmvQYC2hfb0iF16Uw== dependencies: undici-types "~6.19.2" @@ -12401,7 +12401,7 @@ typescript-docs-verifier@^2.5.0: tsconfig "^7.0.0" yargs "^17.5.1" -typescript@5.4.2, typescript@^5.4.2: +typescript@5.4.2: version "5.4.2" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.2.tgz#0ae9cebcfae970718474fe0da2c090cad6577372" integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ== @@ -12411,6 +12411,11 @@ typescript@5.4.2, typescript@^5.4.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== +typescript@^5.6.3: + version "5.6.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b" + integrity sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw== + uglify-js@^3.1.4: version "3.17.2" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.2.tgz#f55f668b9a64b213977ae688703b6bbb7ca861c6"