-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
lang, ts: Add map type #916
Conversation
CI will fail because of project-serum/serum-ts#181. |
let inner_ty = syn_type_to_idl_type(&type_args[0])?; | ||
IdlType::Option(Box::new(inner_ty)) | ||
} | ||
"Vec" | "VecDeque" | "LinkedList" => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also added support to VecDeque
and LinkedList
since they are serialized by borsh in the same way as Vec
.
@armaniferrante I'm happy to write a simple integration test for this if we can get the borsh PR merged: project-serum/serum-ts#181 |
Sounds great. Let's write a test. |
@kevinheavey maybe I am late but when writing the integration tests keep in mind that Javascript Map does key comparisons by reference (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#key_equality), which works fine for primitive types or values which are the same but here we end up comparing objects which are deep equal but not the same most of the time (e.g., BN objects). |
@joaompfe lol actually if you're still around do you wanna add an integration test? Turns out adding to someone else's PR is messier than I thought |
@joaompfe, can I help with this? I would really like to see this feature merged. |
@joaompfe could be a useful feature |
IDL support for Map types. Depends on project-serum/serum-ts#181.
Because BTreeMap has two generic types I was forced to use syn to extract the two types. Without syn, only with recursive regex, which isn't available. Since I was using syn, I refactored the complete method (if that's not desired I can put it as was).