denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
96.58k stars 5.33k forks source link

[bug] Deno fails compiling with generic inference #3997

Closed brandonkal closed 3 years ago

brandonkal commented 4 years ago

See https://gist.github.com/brandonkal/853c3d1dc53a79d366b6662eaa84bb5f

Details of the bug are contained in the Gist file.

Pinging @kitsonk as he is the TypeScript expert here.

To reproduce, run the file and notice that Deno throws bad TypeScript errors. tsc correctly infers the type of the parameters.

kitsonk commented 4 years ago

Top Level Await is not supported in TypeScript 3.7. We are temporarily getting past this by ignoring the error, but internally TypeScript is not tracking the types right, because it thinks you have invalid syntax.

What version of tsc are you using?

brandonkal commented 4 years ago

3.7.2

brandonkal commented 4 years ago

Interesting though this doesn't appear to be related to the await thing. Wrapping the whole thing in an async function, Deno still spits out the same TS compile errors.

kitsonk commented 4 years ago

@brandonkal what does your tsc config look like?

brandonkal commented 4 years ago

https://github.com/brandonkal/deno-lib/blob/master/tsconfig.json

Maybe I've got something odd going on in my environment. I'm seeing the effect of "strictNullChecks" but now looking at my tsconfig, it is not specified there.

I have axetroy.vscode-deno installed.

kitsonk commented 4 years ago

@brandonkal you can't run tsc based on the tsconfig.json and have your example compile. Could you please provide an example where tsc successfully compiles?

bartlomieju commented 3 years ago

@kitsonk PTAL if this issue is still relevant

kitsonk commented 3 years ago

This was always an external issue, and there was outstanding information requested that was outstanding. Closing due to inaction.