Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deno check != tsc w.r.t. Object.keys() #28433

Open
NfNitLoop opened this issue Mar 8, 2025 · 1 comment
Open

deno check != tsc w.r.t. Object.keys() #28433

NfNitLoop opened this issue Mar 8, 2025 · 1 comment

Comments

@NfNitLoop
Copy link

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 processPoints(points: Point[]): string[] {
  // Should error on Object.keys(number), TS2345: Argument of type 'number' is not assignable to parameter of type 'object'.
  return Object.keys(points[3].foo);
}

deno check reports no errors.

But TSC says:

> deno run -ER npm:typescript@5.7.3/tsc --noEmit foo.ts
foo.ts:10:24 - error TS2345: Argument of type 'number' is not assignable to parameter of type 'object'.

10     return Object.keys(points[3].foo);
                          ~~~~~~~~~~~~~


Found 1 error in foo.ts:10
@NfNitLoop
Copy link
Author

Image

VSCode shows an overload that seems to be the culprit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant