denoland / deno

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

`deno types` command broken by "deno_net" extension refactor #11596

Open trgwii opened 3 years ago

trgwii commented 3 years ago

deno types no longer sufficiently outputs all Deno types, but instead outputs some text with the following line near the top: /// <reference lib="deno.net" />

This means that it's not possible for TypeScript or other tools to resolve the full Deno API based on output from deno types anymore (since 1.12 at least).

I think it would be more useful to concat the various dts files when a user runs deno types, so a full representation of the API is outputted. ( https://github.com/denoland/deno/blob/main/extensions/net/lib.deno_net.d.ts )

trgwii commented 3 years ago

@bartlomieju you might be interested in this, I see you separated the deno_net code out from core.

trgwii commented 3 years ago

I suspect the Deno plugin for JetBrains IDEs is broken in 1.12 because of this: chrome_2021-08-06_08-45-31

( https://deno.land/manual/getting_started/setup_your_environment#jetbrains-ides )

kitsonk commented 3 years ago

@bartlomieju the types are concatenated in the file, but we need to strip out the lib reference somehow as it does break deno types output.

bartlomieju commented 3 years ago

@bartlomieju the types are concatenated in the file, but we need to strip out the lib reference somehow as it does break deno types output.

Do we even need to add /// <reference lib="deno.net" /> to lib.deno.ns.d.ts? No other lib is linked that way.

lucacasonato commented 3 years ago

@bartlomieju Because deno.net is the only lib that exposes ns APIs. The other libs are all linked into deno.shared_globals because they implement web APIs.

bartlomieju commented 3 years ago

@bartlomieju Because deno.net is the only lib that exposes ns APIs. The other libs are all linked into deno.shared_globals because they implement web APIs.

Okay, then why would we need to strip that single reference and not all other references? I'm a bit lost on what's the problem here.

The deno.net lib is already concatenated in the deno types output: https://github.com/denoland/deno/blob/15b0e61de523c1a0157e754379f0ec7decf0c23e/cli/main.rs#L333-L357

bartlomieju commented 3 years ago

I just checked against latest commit on main and I can see proper output for types, even deno doc --builtin shows all symbols from deno_net crate (both stable and unstable).

trgwii commented 3 years ago

Yes, I was mistaken, types are concatenated, but the broken reference triple slash directive breaks other tooling that tries to read the types, and I assume the purpose of the deno types command is to support other tooling?