Type specification in `for`
edemaine opened this issue · comments
I think we should allow specifying the type of declarations within for
loops. Examples:
for x: T of y
for x: T in y
for each x: T of y
for let [x, y]: [A, B] of y
Some of these currently have a different meaning (e.g. for {x: T} of y
). An alternative that would preserve this implicit object destructuring meaning would be able to allow type specifiers only when there's an explicit const
/let
/var
:
for const x: T of y