-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incompatible types when using beet.bignum in a fixed size array #35
Comments
Works fine with u32 and lower (using number instead of BN/bignum) |
Hi, sorry for the late reply ... could you please provide me a complete repro sample IDL so I could easier get started on fixing this please? Thanks. |
No worries: As I'm not from the Switchboard team, but merely working with them, I cannot provide the source code. |
Looking into this I get another error actually:
Fixed them one by one by adding some field for those and then things work fine as in I cannot repro your issue. Are you sure you supplied the correct IDL? |
Yes, we modified Beet to accommodate for this. But the issue I'm referring to here is harder than we expected, so we decided to ask for help. If you like to, we could create a PR with the modifications we did, which increase compatibility with some IDLs (we tested and improved on at least two different ones). EDIT: And you tried compiling a project with the given generated code? |
Well in either case I'd like to reproduce the issue first, but the IDL you provided doesn't do that. I'm happy to look at a PR which allows empty structs ideally with a use-case/sample included.
Yes, I created an integration test for this which renders the code and then checks it in multiple ways (including TS compilation). To be double sure I even went into the generated folder and did |
I'm now thinking that maybe either your version of beet is out of date with this one and/or the modifications you did are causing these issues. |
It could indeed be out of date, as we forked a version of Beet, which is back from June. We'll try to use the newest version now and I'll keep you posted |
I think I'm getting a similar error when building TS. |
/**
* Arguments used to create {@link UserEntrantData}
* @category Accounts
* @category generated
*/
export type UserEntrantDataArgs = {
front: number
rear: number
entrantsQueue: web3.PublicKey[] /* size: 5 */
}
/* ...... */
/**
* @category Accounts
* @category generated
*/
export const userEntrantDataBeet = new beet.BeetStruct<
UserEntrantData,
UserEntrantDataArgs & {
accountDiscriminator: number[] /* size: 8 */
}
>(
[
['accountDiscriminator', beet.uniformFixedSizeArray(beet.u8, 8)],
['front', beet.u32],
['rear', beet.u32],
['entrantsQueue', beet.uniformFixedSizeArray(beetSolana.publicKey, 5)],
/* -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ */
],
UserEntrantData.fromArgs,
'UserEntrantData'
)
beet/types.ts Ignoring Partial as a temporary workaround |
@DavidBarrick @millaron thanks for reporting those related cases. Then I can have a look on how to fix those. |
has the same TSC errors, to find a work around I downgraded {
"dependencies": {
"@metaplex-foundation/js": "0.18.1",
"@solana/web3.js": "1.73.2",
"typescript": "4.7.4"
}
} note the rest of deps and package.json fields are omitted |
metaplex-foundation/js and /beet packages has issues with typescript greater than 4.7.4 downgrading typescript solved the issue for more info check metaplex-foundation/beet#35 (comment)
It looks like the issue is with the Here's an example of what the updated IDL would look like:
After making this change, you'll need to regenerate the code using solita to update the generated code. |
Hi guys,
I get the following error when compiling TS:
Caused by this generated code:
From given IDL:
The text was updated successfully, but these errors were encountered: