Conversation
69cb6ab to
f92e66d
Compare
a064ca1 to
b8d7a5b
Compare
8d770dd to
2f3635d
Compare
d77ebed to
0f01d8f
Compare
There was a problem hiding this comment.
Pull request overview
This PR upgrades the monorepo’s TypeScript toolchain to TypeScript 5.8.3 (via pnpm catalog) and aligns @types/node across packages (pinned in catalog), with follow-up type/config changes to keep builds passing under the newer type system.
Changes:
- Add
typescriptand@types/nodeto the pnpmcatalog:and migrate many packages to consume them from the catalog. - Adjust
tsconfig/package devDependencies to include Node types where Node globals/Bufferare relied upon. - Apply targeted TS 5.8 /
@types/nodefixes in a few runtime and test files (typing adjustments, minor refactors).
Reviewed changes
Copilot reviewed 192 out of 196 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/github-bot/package.json | Switch @types/node to catalog:. |
| tools/actions/package.json | Switch @types/node to catalog:. |
| tools/actions/mobile-performance-test/package.json | Switch typescript to catalog:. |
| tools/actions/generate-bot-super-report/package.json | Switch @types/node to catalog:. |
| tests/dummy-wallet-app/package.json | Switch @types/node/typescript to catalog:. |
| tests/dummy-live-app/package.json | Switch @types/node to catalog:. |
| pnpm-workspace.yaml | Add typescript and @types/node to the pnpm catalog. |
| package.json | Switch root typescript to catalog:. |
| libs/wallet-api-acre-module/package.json | Switch @types/node to catalog:. |
| libs/ui/packages/react/src/components/layout/Drawer/index.tsx | Remove redundant JSX truthy expression in header title rendering. |
| libs/ui/packages/native/package.json | Switch @types/node to catalog:. |
| libs/speculos-transport/package.json | Switch @types/node to catalog:. |
| libs/psbtv2/package.json | Switch @types/node/typescript to catalog:. |
| libs/live-signer-solana/package.json | Switch @types/node to catalog:. |
| libs/live-signer-evm/package.json | Switch @types/node to catalog:. |
| libs/live-signer-canton/package.json | Switch @types/node to catalog:. |
| libs/live-signer-aleo/package.json | Switch @types/node to catalog:. |
| libs/live-network/package.json | Switch @types/node to catalog:. |
| libs/live-dmk-speculos/tsconfig.json | Add node to types. |
| libs/live-dmk-speculos/package.json | Switch @types/node to catalog:. |
| libs/live-dmk-shared/tsconfig.prod.json | Set prod types to include node. |
| libs/live-dmk-shared/tsconfig.json | Add node to types. |
| libs/live-dmk-shared/package.json | Switch @types/node to catalog:. |
| libs/live-dmk-mobile/tsconfig.prod.json | Set prod types to include node. |
| libs/live-dmk-mobile/tsconfig.json | Add node to types. |
| libs/live-dmk-mobile/package.json | Switch @types/node to catalog:. |
| libs/live-dmk-desktop/tsconfig.prod.json | Set prod types to include node. |
| libs/live-dmk-desktop/tsconfig.json | Add node to types. |
| libs/live-dmk-desktop/package.json | Switch @types/node to catalog:. |
| libs/live-currency-format/src/localeUtility.ts | Tighten literal typing for Intl.NumberFormatOptions (as const). |
| libs/live-countervalues/tsconfig.json | Update lib target to es2022 and add node types. |
| libs/live-countervalues/package.json | Add @types/node devDependency via catalog:. |
| libs/live-config/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/types-live/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/types-devices/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/types-cryptoassets/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/swift-bridge-hw-transport-ble/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/swift-bridge-hw-app-solana/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/swift-bridge-hw-app-eth/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/react-native-hw-transport-ble/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/react-native-hid/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/logs/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-webusb/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-webhid/src/TransportWebHID.ts | Remove unnecessary Buffer cast by relying on correct typings. |
| libs/ledgerjs/packages/hw-transport-webhid/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-web-ble/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-vault/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-node-speculos/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-node-speculos-http/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-node-hid/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-node-hid-singleton/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-node-hid-noevents/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-mocker/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-transport-http/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-bolos/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-xrp/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-vet/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-trx/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-tezos/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-sui/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-str/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-solana/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-polkadot/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-near/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-multiversx/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-kaspa/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-icon/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-helium/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-hedera/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-exchange/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-eth/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-cosmos/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-concordium/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-celo/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-canton/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-btc/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-aptos/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/hw-app-algorand/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/errors/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/devices/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/packages/cryptoassets/package.json | Switch @types/node to catalog:. |
| libs/ledgerjs/package.json | Switch @types/node to catalog:. |
| libs/ledger-services/trust/package.json | Switch @types/node to catalog:. |
| libs/ledger-services/cal/package.json | Switch @types/node to catalog:. |
| libs/ledger-live-common/src/bot/portfolio/audits.ts | Refine PerformanceEntry.detail typing and guard URL presence. |
| libs/ledger-live-common/package.json | Switch @types/node/typescript to catalog:. |
| libs/ledger-key-ring-protocol/tsconfig.json | Add node to types. |
| libs/ledger-key-ring-protocol/package.json | Add @types/node via catalog:. |
| libs/hw-ledger-key-ring-protocol/tsconfig.json | Add node to types. |
| libs/hw-ledger-key-ring-protocol/package.json | Add @types/node via catalog:. |
| libs/feature-flag-module/package.json | Switch @types/node to catalog:. |
| libs/exchange-module/package.json | Switch @types/node to catalog:. |
| libs/evm-tools/package.json | Switch @types/node to catalog:. |
| libs/domain-service/package.json | Switch @types/node to catalog:. |
| libs/disable-network-setup/package.json | Switch typescript to catalog:. |
| libs/device-react/package.json | Switch @types/node to catalog:. |
| libs/device-core/package.json | Switch @types/node to catalog:. |
| libs/deeplink-module/package.json | Switch @types/node to catalog:. |
| libs/concordium-core/package.json | Switch @types/node to catalog:. |
| libs/coin-tester/package.json | Switch @types/node/typescript to catalog:. |
| libs/coin-tester-modules/coin-tester-solana/tsconfig.json | Add node/jest to types. |
| libs/coin-tester-modules/coin-tester-solana/package.json | Add @types/node and switch typescript to catalog:. |
| libs/coin-tester-modules/coin-tester-polkadot/package.json | Switch typescript to catalog:. |
| libs/coin-tester-modules/coin-tester-evm/package.json | Switch typescript to catalog:. |
| libs/coin-tester-modules/coin-tester-bitcoin/src/atlas.ts | Work around process.on typing by binding a simplified signature. |
| libs/coin-tester-modules/coin-tester-bitcoin/package.json | Switch typescript to catalog:. |
| libs/coin-modules/zcash-shielded/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/zcash-shielded/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-xrp/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-xrp/package.json | Add @types/node; switch typescript to catalog:. |
| libs/coin-modules/coin-vechain/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-vechain/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-tron/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-tron/package.json | Add @types/node; switch typescript to catalog:. |
| libs/coin-modules/coin-ton/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-ton/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-tezos/package.json | Add @types/node; switch typescript to catalog:. |
| libs/coin-modules/coin-sui/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-sui/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-stellar/package.json | Switch @types/node to catalog:. |
| libs/coin-modules/coin-stacks/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-stacks/package.json | Add @types/node; switch typescript to catalog:. |
| libs/coin-modules/coin-solana/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-solana/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-polkadot/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-polkadot/src/bridge/exchange.ts | Remove Buffer/Uint8Array casts; rely on proper Node typings. |
| libs/coin-modules/coin-polkadot/package.json | Add @types/node; switch typescript to catalog:. |
| libs/coin-modules/coin-near/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-near/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-multiversx/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-multiversx/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-module-boilerplate/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-module-boilerplate/package.json | Add @types/node; switch typescript to catalog:. |
| libs/coin-modules/coin-mina/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-mina/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-kaspa/tsconfig.json | Update lib to es2022; add node/jest to types. |
| libs/coin-modules/coin-kaspa/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-internet_computer/tsconfig.json | Update lib to es2022; add node/jest to types. |
| libs/coin-modules/coin-internet_computer/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-icon/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-icon/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-hedera/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-hedera/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-filecoin/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-filecoin/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-evm/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-evm/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-cosmos/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-cosmos/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-concordium/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-concordium/package.json | Add @types/node; switch typescript to catalog:. |
| libs/coin-modules/coin-celo/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-celo/package.json | Add @types/node; switch typescript to catalog:. |
| libs/coin-modules/coin-casper/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-casper/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-cardano/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-cardano/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-canton/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-canton/package.json | Add @types/node; switch typescript to catalog:. |
| libs/coin-modules/coin-bitcoin/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-bitcoin/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-aptos/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-aptos/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-algorand/tsconfig.json | Add node/jest to types. |
| libs/coin-modules/coin-algorand/package.json | Add @types/node via catalog:. |
| libs/coin-modules/coin-aleo/tsconfig.json | Update lib to es2022; add node/jest to types. |
| libs/coin-modules/coin-aleo/package.json | Add @types/node via catalog:. |
| libs/coin-modules-monitoring/package.json | Switch @types/node to catalog:. |
| libs/coin-framework/tsconfig.json | Add node/jest to types. |
| libs/coin-framework/package.json | Add @types/node via catalog:. |
| libs/client-ids/package.json | Switch @types/node to catalog:. |
| features/market-banner/package.json | Switch @types/node/typescript to catalog:. |
| e2e/mobile/tsconfig.json | Add node/jest to types and reformat config. |
| e2e/mobile/package.json | Add @types/node via catalog:. |
| e2e/mobile/jest.globalTeardown.ts | Fix timeout typing and document JSON require. |
| e2e/desktop/package.json | Switch @types/node to catalog:. |
| apps/web-tools/src/repl/live-common-setup.ts | Use TransportWebUSB.open parameter type for WebUSB device map. |
| apps/web-tools/package.json | Switch typescript/@types/node to catalog:. |
| apps/ledger-live-mobile/tsconfig.json | Add node to types. |
| apps/ledger-live-mobile/package.json | Add @types/node via catalog:. |
| apps/ledger-live-mobile/ios/ledgerlivemobile.xcodeproj/project.pbxproj | Update React Native path hashes (pnpm resolution). |
| apps/ledger-live-mobile/ios/Podfile.lock | Update pod sources/checksums to match updated node_modules resolution. |
| apps/ledger-live-mobile/global.d.ts | Add broad GlobalThis index signature to suppress strict global errors. |
| apps/ledger-live-desktop/src/mvvm/features/Send/screens/Confirmation/components/Content/SuccessContent.tsx | Tailwind class order normalization. |
| apps/ledger-live-desktop/src/mvvm/features/Send/screens/Confirmation/components/Content/InfoContent.tsx | Tailwind class order normalization. |
| apps/ledger-live-desktop/src/mvvm/features/Send/screens/Confirmation/components/Content/ErrorContent.tsx | Tailwind class order normalization. |
| apps/ledger-live-desktop/src/mvvm/features/Send/components/SendFlowLayout.tsx | Tailwind class order normalization. |
| apps/ledger-live-desktop/src/main/db/crypto.ts | Work around removed createDecipher typings for legacy decryption path. |
| apps/ledger-live-desktop/src/main/cleanupUserData.test.ts | Adjust mock return typing for fsPromises.readdir. |
| apps/ledger-live-desktop/package.json | Add @types/node; switch typescript to catalog:. |
| apps/ledger-live-desktop/index-types.d.ts | Add broad GlobalThis index signature. |
| apps/cli/src/commands/device/managerListApps.ts | Remove @ts-expect-error around .result access in rxjs pipeline. |
| apps/cli/package.json | Switch @types/node to catalog:. |
| .changeset/smooth-falcons-rush.md | Changeset to publish many packages for the TS/@types update. |
| // createDecipher removed from @types/node 22 (deprecated in Node) but still exists at runtime | ||
| const decipher = ( | ||
| crypto as unknown as { | ||
| createDecipher: (alg: string, key: string) => ReturnType<typeof crypto.createDecipheriv>; | ||
| } | ||
| ).createDecipher(ENCRYPTION_ALGORITHM, encryptionKey); |
There was a problem hiding this comment.
The fallback path calls crypto.createDecipher via a cast. If createDecipher is actually absent at runtime (it’s removed from @types/node 22 and may also be missing in newer Node/Electron), this will throw a TypeError and prevent decrypting legacy databases. Consider feature-detecting (typeof ...createDecipher === "function") and either (1) implementing the legacy derivation using supported APIs (createDecipheriv) or (2) throwing a clearer error explaining that the legacy format can’t be decrypted on this runtime.
| // createDecipher removed from @types/node 22 (deprecated in Node) but still exists at runtime | |
| const decipher = ( | |
| crypto as unknown as { | |
| createDecipher: (alg: string, key: string) => ReturnType<typeof crypto.createDecipheriv>; | |
| } | |
| ).createDecipher(ENCRYPTION_ALGORITHM, encryptionKey); | |
| // createDecipher removed from @types/node 22 (deprecated in Node) and may be missing at runtime | |
| const legacyCreateDecipher = (crypto as any).createDecipher; | |
| if (typeof legacyCreateDecipher !== "function") { | |
| log( | |
| "db/crypto", | |
| "legacy encrypted database format cannot be decrypted: crypto.createDecipher is unavailable on this runtime", | |
| ); | |
| throw new Error( | |
| "Legacy encrypted database format is not supported on this runtime (crypto.createDecipher is unavailable). " + | |
| "Please migrate your data using a version of Ledger Live that supports the legacy format.", | |
| ); | |
| } | |
| const decipher = legacyCreateDecipher(ENCRYPTION_ALGORITHM, encryptionKey); |
There was a problem hiding this comment.
well, that's an accepted code smell for now, the problem referred to here already exist in prod. but good point. i'll see if it can be resolved properly... that said, the present PR aim to be NO BREAKING, no actual code change, only typechecks. so i think i'll create a task
There was a problem hiding this comment.
0f01d8f to
2c2b95c
Compare
|
rebased + cherry-picked #14939 in commit just to anticipate the integration tests fix that comes, after this we're supposed to have all greens on CI 🤞 |
|
2c2b95c to
386739a
Compare
| // Allow custom properties on global/globalThis (tests, AppGeoBlocker, etc.) | ||
| declare global { | ||
| interface GlobalThis { | ||
| [key: string]: any; | ||
| } | ||
| } |
There was a problem hiding this comment.
neat pick: Maybe we'll want to be explicit with the types of what we put in global, wdyt ?
There was a problem hiding this comment.
i'll create a ticket so we don't forget to refine this https://ledgerhq.atlassian.net/browse/LIVE-27126
dceb492
386739a to
dceb492
Compare
|



✅ Checklist
npx changesetwas attached.📝 Description
catalog:.catalog:.Changes
hw-ledger-key-ring-protocol,hw-app-btc,hw-app-kaspa,hw-transport-webhid, andcoin-polkadot; added@types/nodeand"types": ["node"]where needed so Buffer is correctly typed.@types/nodeand"types": ["node"](and"jest"where tests are compiled) in libs that rely on Node globals or Buffer (e.g. hw-ledger-key-ring-protocol, coin-modules, coin-testers, live-dmk-desktop).live-currency-format(NumberFormatOptions),getTrustedInputBIP143(Buffer.concat), coin-tester-bitcoin (process.onoverload), react-ui Drawer (redundant truthy expression), live-dmk-desktop prod tsconfig, live-common audits (PerformanceEntry.detailtyping).Why not TypeScript 5.9?
TypeScript 5.9 introduces stricter
Uint8Arraytypings (genericArrayBuffervsArrayBufferLike), which caused many type errors (e.g. 57 inhw-ledger-key-ring-protocol). We stayed on 5.8.3 to avoid a broader refactor ofUint8Arrayusage across the repo.Future
This work is to ease future usage of tsgo ( see state at #14651 )
❓ Context
🧐 Checklist for the PR Reviewers