safe-core-sdk icon indicating copy to clipboard operation
safe-core-sdk copied to clipboard

Typechain artifacts contain ts files

Open jmrossy opened this issue 2 months ago • 0 comments

Description

The typechain artifacts included in the protocol-kit package include ts files, but only for one specific contract: Multi_send.ts

When a TS file is present, for most modern ts module settings (e.g. node16, nodenext, es2020, es2022, etc.), Typescript will prefer ts files over js files. The problem is, these generated TS files contain unused imports. Meaning anyone with the noUnusedLocals setting (a common and useful setting), will see errors like these:

node_modules/@safe-global/protocol-kit/dist/typechain/src/web3-v1/v1.1.1/Multi_send.ts (5,1): error TS6133: 'BN' is declared but its value is never read.

Screenshot 2024-05-06 at 3 59 50 PM

Environment

  • Version: Tested with @safe-global/protocol-kit 1.3.0 and 3.1.0
  • Environment: node 20

Steps to reproduce

Observed in the Hyperlane monorepo forcing a workaround like this: https://github.com/hyperlane-xyz/hyperlane-monorepo/pull/3694/files#diff-b285166fe6e6339693f5c697a3a6ce23d8e8c8a01baf28d027f01f17f34a1809R70

To reproduce, use this lib in a package with a tsconfig like this one: https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/tsconfig.json

Expected result

No build errors

Additional context

Screenshot 2024-05-06 at 4 08 04 PM

jmrossy avatar May 06 '24 20:05 jmrossy