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

LSP actions use @deno-types instead pf @ts-types #27309

Closed
kt3k opened this issue Dec 10, 2024 · 4 comments · Fixed by #27310
Closed

LSP actions use @deno-types instead pf @ts-types #27309

kt3k opened this issue Dec 10, 2024 · 4 comments · Fixed by #27310
Labels
good first issue Good for newcomers

Comments

@kt3k
Copy link
Member

kt3k commented Dec 10, 2024

LSP code actions use @deno-types for adding types to the import statement. These should be replaced with @ts-types as @ts-types is now more recommended than @deno-types

$ git grep --line-number deno-types cli/lsp/
cli/lsp/analysis.rs:1390:        "{}// @deno-types=\"{}\"\n",
cli/lsp/analysis.rs:1403:          "Add @deno-types directive for \"{}\"",
cli/lsp/diagnostics.rs:1358:    // @deno-types and that's a bit complicated to explain
cli/lsp/diagnostics.rs:1526:  // TODO(nayeemrmn): This is a crude way of detecting `@deno-types` which has
cli/lsp/diagnostics.rs:1543:        // If not @deno-types, diagnose the types if the code errored because
cli/lsp/diagnostics.rs:1954:        // @deno-types="bad.d.ts"
cli/lsp/tsc.rs:3422:                  "// @deno-types=\"{}\"\n{}",
cli/lsp/tsc.rs:3598:            "// @deno-types=\"{}\"\n{}",

Version: Deno 2.1.3

@kt3k kt3k added the good first issue Good for newcomers label Dec 10, 2024
@MohammadSu1
Copy link
Contributor

I will pick this up

@skeithtan
Copy link
Contributor

skeithtan commented Dec 11, 2024

Where do I get more information about @ts-types being more recommended than @deno-types?

Deno's documentation still references @deno-types for NPM's @types import:
https://docs.deno.com/runtime/fundamentals/node/#importing-types

@kt3k
Copy link
Member Author

kt3k commented Dec 11, 2024

We used to have this note in the docs:

ℹ️ Note: The directive @deno-types can be used as an alias for
@ts-types. This is not recommended anymore.

https://github.com/denoland/docs/pull/502/files#diff-48be754e581d83d441f97da424c2ab4da89f3fdc61d9af9a493e7c610de73775R56-R57

But we accidentally removed it at some point. We are fixing it in denoland/docs#1256


@ts-types was added in this PR in deno_graph denoland/deno_graph#444

deno_graph crates was upgraded to the corresponding version in this PR #23513

So this change happened at Deno v1.43.0 (but apparently we didn't communicate this very well...)

@jsejcksn
Copy link
Contributor

Where do I get more information about @ts-types being more recommended than @ts-types?

@skeithtan After denoland/docs#1256 was merged, the docs page with the information is at the following URL:

https://docs.deno.com/runtime/reference/ts_config_migration/#providing-types-when-importing

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

Successfully merging a pull request may close this issue.

4 participants