Closed comhon-project closed 7 months ago
Thanks for this report — here's the relevant example updated without casting.
https://formkit.link/2451aba9e7bd547ce3ed74c6a67515cf
@justin-schroeder, has something changed regarding the need for casting? https://formkit.com/essentials/schema#loops
Oh yeah, we patched that issue a few months ago. Good catch.
Here is the text of that "Casting" block:
Sometimes schema expressions need to cast a string to a number. For example, keys are always string values during an iteration, so in the above example it was necessary to cast
$key
to an integer before adding it to1
. To perform this cast, we simply multiplied by 1:$key * 1
before performing our addition.
If casting is no longer necessary, I'd be happy to submit a PR that removes the "Casting" block and updates the example.
@justin-schroeder, just say the word.
yeah that should have been updated. Would love a fix for that @kswedberg
in chapter schema -> loops, there is a block
casting
that say we must cast values sometimes. but in the example, it seems to work without performing the cast$key * 1
. maybe cast is not required anymore or the example is not relevant