foo = (list) ->
[ first, ..., last ] = list
results in TypeError: Cannot read property 'indexOf' of undefined
That’s the simplest case I could come up with. It’s pretty finicky though, if you reference the values after the destructuring statement it compiles:
foo = (list) ->
[ first, ..., last ] = list
[ first, last ]
However other more complex variations also fail, for instance having that statement inside conditional assignment:
foo = (list) ->
ret =
if list.length
[ first, ..., last ] = list
[ first, last ]
else
[]
removing the ret = part of the last example compiles fine
Not a huge deal, it can be replaced with code that explicitly uses list.slice -1, it’s just we had some code that was compiling previously and stopped working with a minor update somewhere along the way
results in
TypeError: Cannot read property 'indexOf' of undefinedThat’s the simplest case I could come up with. It’s pretty finicky though, if you reference the values after the destructuring statement it compiles:
However other more complex variations also fail, for instance having that statement inside conditional assignment:
removing the
ret =part of the last example compiles fineNot a huge deal, it can be replaced with code that explicitly uses
list.slice -1, it’s just we had some code that was compiling previously and stopped working with a minor update somewhere along the way