TypeScript Error with override Keyword in SendUserOperationError Class
ardaerturk opened this issue · 7 comments
Issue Description
I am encountering a TypeScript compilation error related to the SendUserOperationError class in the permissionless library. The issue seems to arise from the use of the override keyword in a class member that is not present in the base class BaseError.
Error Message
node_modules/permissionless/errors/sendUserOperation.ts:10:14 - error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'BaseError'.
Steps to Reproduce
- Include the permissionless library in a TypeScript project.
- Run TypeScript compilation.
- The above error is encountered.
Attempted Workarounds
- Adjusted tsconfig.json with "skipLibCheck": true, but the issue persists.
- Created a custom .d.ts file to override the problematic class, but this hasn't resolved the issue.
- Attempted patching the module, but encountered issues when deploying on our EC2 instance.
Possible Solution
It seems that the override keyword is used in a derived class where the base class (BaseError) does not declare the member being overridden. Removing the override keyword or adjusting the base class to include this member might resolve this issue.
Additional context:
we are using viem@2.7.6
and permissionless@0.0.35
hey are you using es2022
?
I can confirm, es2022
helped to resolve the same issue for me few days ago
I've switched it to es2022
from es2020
, I'm getting 40 different errors from permissionless
now:
/node_modules/permissionless/actions/smartAccount/sendTransaction.ts
114:8-21
[tsl] ERROR in /node_modules/permissionless/actions/smartAccount/sendTransaction.ts(114,9)
TS2375: Type '{ sender: `0x${string}`; paymasterAndData: "0x"; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; callData: `0x${string}`; nonce: bigint | undefined; }' is not assignable to type 'PartialBy<UserOperation, "sender" | "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "initCode" | "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymasterAndData" | "signature">' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Type '{ sender: `0x${string}`; paymasterAndData: "0x"; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; callData: `0x${string}`; nonce: bigint | undefined; }' is not assignable to type 'Partial<Pick<UserOperation, "sender" | "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "initCode" | "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymasterAndData" | "signature">>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'nonce' are incompatible.
Type 'bigint | undefined' is not assignable to type 'bigint'.
Type 'undefined' is not assignable to type 'bigint'.
ERROR in node_modules/permissionless/actions/smartAccount/signTypedData.ts
137:46-56
[tsl] ERROR in node_modules/permissionless/actions/smartAccount/signTypedData.ts(137,47)
TS2379: Argument of type '{ domain: ((TTypedData extends { [x: string]: readonly TypedDataParameter[]; [x: `string[${string}]`]: undefined; [x: `function[${string}]`]: undefined; [x: `address[${string}]`]: undefined; [x: `uint256[${string}]`]: undefined; [x: `bytes[${string}]`]: undefined; [x: `bytes32[${string}]`]: undefined; [x: `bool[${st...' is not assignable to parameter of type '{ domain?: TypedDataDomain; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'domain' are incompatible.
Type '((TTypedData extends { [x: string]: readonly TypedDataParameter[]; [x: `string[${string}]`]: undefined; [x: `function[${string}]`]: undefined; [x: `address[${string}]`]: undefined; [x: `uint256[${string}]`]: undefined; [x: `bytes[${string}]`]: undefined; [x: `bytes32[${string}]`]: undefined; [x: `bool[${string}]`]: ...' is not assignable to type 'TypedDataDomain'.
Type 'undefined' is not assignable to type 'TypedDataDomain'.
ERROR in /node_modules/permissionless/actions/smartAccount/sendTransactions.ts
118:8-21
[tsl] ERROR in /node_modules/permissionless/actions/smartAccount/sendTransactions.ts(118,9)
TS2375: Type '{ sender: `0x${string}`; paymasterAndData: "0x"; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; callData: `0x${string}`; nonce: bigint | undefined; }' is not assignable to type 'PartialBy<UserOperation, "sender" | "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "initCode" | "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymasterAndData" | "signature">' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Type '{ sender: `0x${string}`; paymasterAndData: "0x"; maxFeePerGas: bigint; maxPriorityFeePerGas: bigint; callData: `0x${string}`; nonce: bigint | undefined; }' is not assignable to type 'Partial<Pick<UserOperation, "sender" | "nonce" | "maxFeePerGas" | "maxPriorityFeePerGas" | "initCode" | "callGasLimit" | "verificationGasLimit" | "preVerificationGas" | "paymasterAndData" | "signature">>' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'nonce' are incompatible.
Type 'bigint | undefined' is not assignable to type 'bigint'.
Type 'undefined' is not assignable to type 'bigint'.
Which version are you using?
"permissionless": "^0.0.34"
Hey so with viem 2.x.x
you will have to use permissionless 0.1.x