denoland / deno

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

lsp: slow types diagnostics quick fixes #22713

Open kitsonk opened 7 months ago

kitsonk commented 7 months ago

In order to reduce developer friction, the LSP could support surfacing slow type diagnostics directly in an IDE.

For example, the following slow type diagnostic could be made available:

error[missing-explicit-return-type]: missing explicit return type in the public API
   --> /Users/kitsonk/github/oak/application.ts:841:3
    | 
841 |   [Symbol.for("Deno.customInspect")](
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this function is missing an explicit return type
    = hint: add an explicit return type to the function

  info: all functions in the public API must have an explicit return type
  docs: https://jsr.io/go/slow-type-missing-explicit-return-type

In addition, the lsp could make quick fixes available to extract the inferred type from tsc to resolve the diagnostic.

dsherret commented 7 months ago

Slowly getting there (ex. https://github.com/denoland/deno/pull/22615)

alexgleason commented 6 months ago

Is there a command besides deno publish you can run to show slow types?

dsherret commented 6 months ago

deno publish --dry-run or deno lint when there's a deno.json with "name", "verison", and "exports", in the config, or { "lint": { "rules": { "include": ["no-slow-types"] }}}