pimlicolabs / permissionless.js

TypeScript utilities built on viem for ERC-4337: Account Abstraction
https://docs.pimlico.io/permissionless
MIT License
167 stars 46 forks source link

EstimateUserOperationGasError and SendUserOperationError cannot override cause #266

Closed ctrlc03 closed 1 month ago

ctrlc03 commented 1 month ago

Currently, I am unable to use libraries built on top of permissionless.js like @zerodev/sdk due to this error present at https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/errors/estimateUserOperationGas.ts#L13 and https://github.com/pimlicolabs/permissionless.js/blob/main/packages/permissionless/errors/sendUserOperation.ts#L13

This member cannot have an 'override' modifier because it is not declared in the base class 'BaseError'.

Looks like an easy fix would be removing the override keyword

plusminushalf commented 1 month ago

Which version of viem and perissionless are you using? Also can you share the tsconfig?

ctrlc03 commented 1 month ago

Which version of viem and perissionless are you using? Also can you share the tsconfig?

Hey thanks for the reply.

viem: 2.16.3 permissionless: 0.1.44

Tsconfig:

  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true
  },
plusminushalf commented 1 month ago

Can you try the following adjustments:

         "module": "NodeNext",
        "target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping.
        "lib": [
            "ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances.
            "DOM" // We are adding `DOM` here to get the `fetch`, etc. types. This should be removed once these types are available via DefinitelyTyped.
        ],
plusminushalf commented 1 month ago

I think this is a good resource on how to map based on your node version - https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping

ctrlc03 commented 1 month ago

Can you try the following adjustments:

         "module": "NodeNext",
        "target": "ES2021", // Setting this to `ES2021` enables native support for `Node v16+`: https://github.com/microsoft/TypeScript/wiki/Node-Target-Mapping.
        "lib": [
            "ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances.
            "DOM" // We are adding `DOM` here to get the `fetch`, etc. types. This should be removed once these types are available via DefinitelyTyped.
        ],

Thanks! no chance that can be fixed? I would rather not go down this route of using esm if possible.

plusminushalf commented 1 month ago

Hey so cause was introduced in ES2022, for a detailed Explanation you can checkout here - https://stackoverflow.com/a/73394582

I understand these versions can be frustrating I hope this will help you a little.

image
ctrlc03 commented 1 month ago

Hey so cause was introduced in ES2022, for a detailed Explanation you can checkout here - https://stackoverflow.com/a/73394582

I understand these versions can be frustrating I hope this will help you a little.

image

gotcha, will amend on my side, appreciate your help with this! 🙏 I'll close the issue