Type 'unknown' is not assignable to type 'TypedDataDomain | undefined' compilation error
denys5dev opened this issue · 2 comments
denys5dev commented
Error looks like related to viem and permissionless(@zerodev/sdk deps) type checks.
"@zerodev/presets": "^5.1.4",
"@zerodev/sdk": "^5.1.14",
"viem": "^2.9.3"
import { createEcdsaKernelAccountClient } from '@zerodev/presets/zerodev';
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts';
import { polygonMumbai } from 'viem/chains';
import { Hex } from 'viem';
async main() {
// Create a signer
const privateKey = generatePrivateKey();
const signer = privateKeyToAccount(privateKey as Hex);
// Create a Kernel client
const kernelClient = await createEcdsaKernelAccountClient({
chain: polygonMumbai,
projectId: 'YOUR_PROJECT_ID', // 'YOUR_PROJECT_ID
signer,
});
}
[ERROR] TS2322: Type '((TTypedData extends { [x: string]: readonly TypedDataParameter[]; [x: `string[${string}]`]: undefined; [x: `function[${string}]`]: undefined; [x: `address[${string}]`]: undefined; [x: `bool[${string}]`]: undefined; [x: `bytes[${string}]`]: undefined; [x: `bytes1[${string}]`]: undefined; [x: `bytes3[${string}]`]: un...' 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: `bool[${string}]`]: undefined; [x: `bytes[${string}]`]: undefined; [x: `bytes1[${string}]`]: undefined; [x: `bytes3[${string}]`]: und...' is not assignable to type 'TypedDataDomain | undefined'.
Type 'unknown' is not assignable to type 'TypedDataDomain | undefined'. [plugin angular-compiler]
node_modules/permissionless/actions/smartAccount/signTypedData.ts:137:48:
137 │ EIP712Domain: getTypesForEIP712Domain({ domain }),
╵ ~~~~~~
The expected type comes from property 'domain' which is declared here on type '{ domain?: TypedDataDomain | undefined; }'
node_modules/viem/_types/utils/typedData.d.ts:13:4:
13 │ domain?: TypedDataDomain | undefined;
╵ ~~~~~~
denys5dev commented
Looks like this combination of deps works fine
"dependencies": {
"@angular/animations": "^17.2.0",
"@angular/common": "^17.2.0",
"@angular/compiler": "^17.2.0",
"@angular/core": "^17.2.0",
"@angular/forms": "^17.2.0",
"@angular/platform-browser": "^17.2.0",
"@angular/platform-browser-dynamic": "^17.2.0",
"@angular/router": "^17.2.0",
"@zerodev/ecdsa-validator": "^5.1.2",
"@zerodev/presets": "^5.1.4",
"@zerodev/sdk": "^5.1.14",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"viem": "^2.9.2"
"zone.js": "~0.14.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^17.2.0",
"@angular/cli": "^17.2.0",
"@angular/compiler-cli": "^17.2.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.3.2"
}
SahilVasava commented
Yes. Weirdly typescript 5.4.x
seems to break the permissionless and viem packages. Stick with ~5.3.x
. I have pushed same change to the repo. Make sure to use bun.lockb
as it is using bun install --frozen-lockfile