Closed gimenete closed 1 year ago
Hey, maybe this field could accept both Record<string, any> or Array
@G4brym that's a good idea. I've just updated the PR do do that 👍
Looks good @gimenete Thanks for contributing this, I will make a new release in the next days to include this
Awesome. Thanks!!
I spent some time trying to understand why something as simple as this wasn't working:
Then, digging into the code and checking the docs I saw that
values
needs to beRecord<string, any>
. But then, why TypeScript wasn't complaining?It turns out that an array of strings satisfies
Record<string, any>
. Yeah: https://www.typescriptlang.org/play?#code/MYewdgzgLgBADgQwE4ILYQFwwEoFNRIAmAPNEgJZgDmANDAmAJ4B8MAvDANoDkC3AugChBoSCAA2uAHTiQVABSIU6AJRASo, It'd be better to use
Record<string, unknown>
instead, which gives a compiler error if you try to pass an array of strings.