TypeScript 5.9 Adds Expandable Hovers |
Written by Ian Elliot | |||
Thursday, 31 July 2025 | |||
The release candidate of TypeScript 5.9 has been announced, with a preview of a new feature providing expandable hovers. TypeScript is a superset of JavaScript that adds optional static types which can be checked by the TypeScript compiler to catch common errors in your programs. TypeScript can use this information to help you avoid about mistakes like typos, missing arguments, or forgetting to check for null and undefined. One of the more interesting additions to this version of TypeScript is a preview of support for expandable hovers. Hovers, aka editor tooltips or the Quick Info feature, let you see what type a variable is, or what a type alias actually refers to. In some cases, you'll want to see more detailed info, but there hasn't until now been a quick way to do this. TypeScript 5.9 is now previewing a feature called expandable hovers, or "quick info verbosity". If you use an editor like VS Code, you'll now see a + and - button on the left of the hover tooltips. Clicking on the + button will expand out types more deeply, while clicking on the - will go back to the last view. An associated addition to the new release is the ability to configure the maximum hover length. At the moment, quick info tooltips can become so long that TypeScript will truncate them to make them more readable. This can mean that TypeScript manages to chop off the useful info you were looking for. To get around this, TypeScript 5.9's language server now supports a configurable hover length, which can be configured in VS Code. You probably won't have to do this, though, because the the new default hover length is substantially larger than the previous default. Other improvements to this release include a substantial rethink of the defaults for what is created as the tsconfig.json file by the --init flag. Until now, running tsc --init created a very "full" tsconfig.json, filled with commented-out settings and their descriptions. The thinking was that developers would be inspired to explore the many options and toggle them as appropriate. As you'd expect, what really happens is people just delete most of the commented out guff and ignore it. In recognition of this, the new version of tsc --init comes with far fewer commented out sections, and a few more useful settings already enabled. TypeScript 5.9 is available as a release candidate now. Ian Elliot is the author of Just JavaScript: An Idiomatic Approach; JavaScript Async; Just jQuery: The Core UI; Just jQuery: Events, Async & AJAX and JavaScript Bitmap Graphics with Canvas. All these titles are part of the I Programmer Library published by I/O Press. More InformationRelated ArticlesTypeScript Improves Never-Initialized Variables Checks TypeScript 5.6 Tightens Truthy And Nullish Checks TypeScript 5.5 Adds ECMAScript Set Support Node.js Adds Experimental TypeScript Support TypeScript 5 - Smaller, Simpler, Faster TypeScript 4.7 Adds Node.js ECMAScript Module Support TypeScript 4.6 Improves Constructors To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |