Skip to content

Conversation

@nathanhleung
Copy link
Contributor

@nathanhleung nathanhleung commented Dec 10, 2024

In #277, a feature was introduced which made empty string values "" in filter_arg correspond to null when decoded. This change was not reflected in the TypeScript types for the shovel-config-ts config generator; this PR changes the types to allow filter_arg to take an empty string value.

When testing my shovel config with the updated types in this PR, I was successfully able to add "" to a filter_arg without type errors.

Something to consider — in the docs, it says:

filter_arg: Not required when using filter_ref. Use filter_arg when you want to filter on static data. Must be an array of strings. The string values will be decoded depending on the value of comparison. Namely, a string with a 0x prefix will be decoded into bytes, a decimal string will be decoded into uint or int, a string of utf8 characters will be decoded into a string, and an empty string will be decoded as an empty value of the type being compared.

Should the type actually be expanded to (Hex | string)[] here, or even just string[]?

@ryandotsmith
Copy link
Member

Good call. Perhaps string[] is best given filter_arg's domain.

@nathanhleung
Copy link
Contributor Author

Good call. Perhaps string[] is best given filter_arg's domain.

Updated!

@ryandotsmith ryandotsmith merged commit af0736e into indexsupply:main Dec 11, 2024
3 checks passed
@ryandotsmith
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants