microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
100.77k stars 12.46k forks source link

Indicate in the editor that a type is explicitly `any` #60189

Open bpasero opened 1 week ago

bpasero commented 1 week ago

šŸ” Search Terms

any marker editor

āœ… Viability Checklist

ā­ Suggestion

Types that are explicitly set to any are sometimes hard to distinguish from actually typed variables in the editor. You might be adopting types while still having a lot of any around and then it would be helpful to call any out more explicitly in the editor.

šŸ“ƒ Motivating Example

I am now using the extension https://marketplace.visualstudio.com/items?itemName=danvk.any-xray which does this:

Image

šŸ’» Use Cases

  1. What do you want to use this for?

Seeing explicit any types easily so that I can work on adding types.

  1. What shortcomings exist with current approaches?

I can disable explicit any by producing errors but that is very aggressive.

  1. What workarounds are you using in the meantime?

Hovering over the type.

RyanCavanaugh commented 1 week ago

What workarounds are you using in the meantime? Hovering over the type.

It seems like you're using the extension, which works?

bpasero commented 1 week ago

@RyanCavanaugh yes I do, but there is gaps and I think scalability concerns / hacks in the implementation so I was hoping for an officially TS supported way of getting this information.

I am also not 100% convinced about the presentation, being forced to see a border around the identifier, something more subtle like this "..." we already see in some cases would be nicer:

Image