Skip to content
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

shovel-config-ts: allow filter_arg to take empty string #280

Merged
merged 2 commits into from
Dec 11, 2024

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