permissionless.js
permissionless.js copied to clipboard
getTypesForEIP712Domain error
Wagmi + Viem + AA upgrade === disaster.
Anyone seen this error:
../../node_modules/permissionless/actions/smartAccount/signTypedData.ts:137:49
const types = {
> 137 | EIP712Domain: getTypesForEIP712Domain({ domain }),
| ^
138 | ...(types_ as TTypedData)
139 | }
'((TTypedData extends { [x: string]: readonly TypedDataParameter[]; [x: `string[${string}]`]: undefined; [x: `function[${string}]`]: undefined; [x: `address[${string}]`]: undefined; [x: `uint32[${string}]`]: undefined; [x: `bytes[${string}]`]: undefined; [x: `uint256[${string}]`]: undefined; [x: `bytes32[${string}]`]...' is not assignable to type 'TypedDataDomain | undefined'.
Type '(TTypedData extends { [x: string]: readonly TypedDataParameter[]; [x: `string[${string}]`]: undefined; [x: `function[${string}]`]: undefined; [x: `address[${string}]`]: undefined; [x: `uint32[${string}]`]: undefined; [x: `bytes[${string}]`]: undefined; [x: `uint256[${string}]`]: undefined; [x: `bytes32[${string}]`]:...' is not assignable to type 'TypedDataDomain | undefined'.
Type 'unknown' is not assignable to type 'TypedDataDomain | undefined'.
"viem": "2.9.3",
"wagmi": "2.5.12",
"@alchemy/aa-accounts": "3.6.1",
"@alchemy/aa-alchemy": "3.7.0",
"@alchemy/aa-core": "3.6.1",
"@alchemy/aa-ethers": "3.6.1",
"@alchemy/aa-signers": "3.6.1",
Same error here. Anyone can help?
Hard to tell what's going on without a minimal reproduction. Likely that skipLibCheck is falsy in your tsconfig.json.
Hey what's your tsconfig's target? or as @jxom pointed out skipLibCheck is falsy in your tsconfig.json
Share the command to reproduce the issue please
The tsconfig skipLibCheck is true in my tsconfig. I solved adding an interface.d.ts file
Hey but can you provide a small repro repo? It will help us solve it!
We're also getting this bug when moving from typescript 5.2.2 -> 5.4.5
../../node_modules/permissionless/actions/smartAccount/signTypedData.ts:139:49 - error TS2322: Type '((TTypedData extends { [x: string]: readonly TypedDataParameter[]; [x: `string[${string}]`]: undefined; [x: `function[${string}]`]: undefined; [x: `address[${string}]`]: undefined; [x: `uint32[${string}]`]: undefined; [x: `uint64[${string}]`]: undefined; [x: `uint256[${string}]`]: undefined; [x: `bytes32[${string}]`...' is not assignable to type 'TypedDataDomain | undefined'.
Type '(TTypedData extends { [x: string]: readonly TypedDataParameter[]; [x: `string[${string}]`]: undefined; [x: `function[${string}]`]: undefined; [x: `address[${string}]`]: undefined; [x: `uint32[${string}]`]: undefined; [x: `uint64[${string}]`]: undefined; [x: `uint256[${string}]`]: undefined; [x: `bytes32[${string}]`]...' is not assignable to type 'TypedDataDomain | undefined'.
Type 'unknown' is not assignable to type 'TypedDataDomain | undefined'.
139 EIP712Domain: getTypesForEIP712Domain({ domain }),
~~~~~~
../../node_modules/viem/_types/utils/typedData.d.ts:13:5
13 domain?: TypedDataDomain | undefined;
~~~~~~
The expected type comes from property 'domain' which is declared here on type '{ domain?: TypedDataDomain | undefined; }'
Found 1 error in ../../node_modules/permissionless/actions/smartAccount/signTypedData.ts:139
trying to get a minimal repro
[edit] It's specifically the 5.4.X typescript upgrade that causes this. 5.3.X does not repro this behavior
Sorry missed the ongoing thread. I can confirm that skipLibCheck is true on my end as well. Typescript upgrades are a huge PITA and cost factor these days :(. Would probably be best to always test on the latest supported Typescript version to catch this early.
obviously this isn't a permanent fix for the issue but you can use patch-package to patch in an ignore flag for this type issue.
Doing this with the patch-package allows the patch to be applied after post-install so this will work in production builds and for other engineers working in the project.
example patch:
const types = {
+ // @ts-ignore
EIP712Domain: getTypesForEIP712Domain({ domain }),
...(types_ as TTypedData)
}