Closed xenoliss closed 7 months ago
Latest commit: 9a03cf1a7fa80e4d8b1d34434d382ed64451bd68
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
abitype | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Mar 14, 2024 7:38am |
Can you add a test based on #231? You can use the provided playground as the base for the test. That way if there is a unforseen regression that test catches it.
Sure! I noticed the type tests are failing. I need to fix that as well when I find time. Any help/guidance is welcomed
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.85%. Comparing base (
6b2979f
) to head (9ad4c80
). Report is 6 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
@xenoliss since depth flatten returns a arraylist now you need to check if it's length is 0 instead of checking if the list member is undefined which was the previous implementation so that it shows as never for the parameters.
Something like this should work. But feel free to take any other approach
? Filter<Mapped, never> extends readonly [...infer Content]
? Content['length'] extends 0
? never
: DeepFlatten<Content>
: never
: never
Hey thank you @Raiden1411, I added your fix and it seems to work fine. I also added the playground test. Let me know how that looks to you.
I think that the only thing that is missing is the changeset otherwise it looks good
I added the changeset @Raiden1411
Description
Hopefully fix https://github.com/wevm/abitype/issues/231
Additional Information
Introduce a
DeepFlatten
and use it inParseAbiParameters
instead of assuming thatFilter<Mapped, never>
has always only one element.NOTE: I had to update
parseAbiParameters
toreturn abiParameters as unknown as ParseAbiParameters<TParams>
for the compiler to be happy but waiting for feedback.Before submitting this issue, please make sure you do the following.
PR-Codex overview
This PR focuses on fixing type detection in
ParseAbiParameters
when using an array.Detailed summary
ParseAbiParameters
DeepFlatten
type for flattening arraysDeepFlatten
AbiParameter
objects