Deno check/lint doesn't warn against obvious bugs
I've run
deno lint --rules-tags=recommended
but it doesn't detect anything. This is quite worrying. PS: should there be a Lint
tag when posting here, now that we have lint plugins?6 Replies
You might be looking for
deno check
instead. At the moment deno lint
does no type checking whereas deno check
does.
In either way there wouldn't be a type error in the code posted. Calling Object.keys()
on a number
always yields an empty array and an empty array is a valid string[]
@marvinh.
deno check
was my first line of defense, but it doesn't output anything about this code. tsc
does:
I see, that sounds like a bug. Can you file an issue for that at https://github.com/denoland/deno/issues ?
It looks like Object.keys() is overloaded:
Did an issue get opened for this? I can add this there if so.

Didn't find it. Created one:
https://github.com/denoland/deno/issues/28433
GitHub
deno check
!= tsc
w.r.t. Object.keys()
· Issue #28433 · denol...Version: deno 2.2.3+0ef3f6b (canary, release, x86_64-pc-windows-msvc) v8 13.4.114.11-rusty typescript 5.7.3 Originally reported on Discord type Point = { [key: string]: number }; function processPo...
As for:
// Should warn on points[3] possibly being undefinedUnfortunately, even typescript "strict" mode doesn't enable this check. There is a LOT of code that just assumes your indexes are in-bounds. It can become tedious to check undefined for all cases. If you want that check, you have to enable: https://www.typescriptlang.org/tsconfig/#noUncheckedIndexedAccess