You are going full speed writing that new piece of code you want. You need to iterate over an array, but suddenly TS complains saying you've got the wrong type for your array member.
You spend fifteen minutes puzzling it out, before you message the team. There can't be anything wrong with your code, it's 3 lines! Is this a bug in TypeScript?
A coworker points it out. You have just been bit by an ancient failing of JavaScript: for ... in instead of for ... of.
I just ran into this scenario and I was thinking it would be awesome if the linter could warn you of this. It's already in typescript-eslint (no-for-in-array), but since Deno is all about DX and it's not very DX-friendly to have to set up a second linter outside your LSP, I thought I would ask.
Basically, deno lint could display an error like "Use of for ... in to iterate over an array, did you mean for ... of?" I don't know how difficult it would be to implement, but it would definitely be nice to have.
You are going full speed writing that new piece of code you want. You need to iterate over an array, but suddenly TS complains saying you've got the wrong type for your array member.
You spend fifteen minutes puzzling it out, before you message the team. There can't be anything wrong with your code, it's 3 lines! Is this a bug in TypeScript?
A coworker points it out. You have just been bit by an ancient failing of JavaScript:
for ... in
instead offor ... of
.I just ran into this scenario and I was thinking it would be awesome if the linter could warn you of this. It's already in
typescript-eslint
(no-for-in-array), but since Deno is all about DX and it's not very DX-friendly to have to set up a second linter outside your LSP, I thought I would ask.Basically,
deno lint
could display an error like "Use offor ... in
to iterate over an array, did you meanfor ... of
?" I don't know how difficult it would be to implement, but it would definitely be nice to have.Thanks in advance!