question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tooltips / IntelliSense: Don't resolve type aliases (aka "semantic sugar") set explicitly

See original GitHub issue

We have defined a bunch of “semantic sugar” type aliases like: image

Status quo (bad): VS Code is resolving these along the alias chain in tooltips and IntelliSense suggestions (which kinda makes non-sense of the type alias in the first place) image(c.f. hovered tooltip over this.url at bottom)

Better: Let VS Code show UrlString as type here instead of string to aid developers with semantic sugar as of what type of string to expect.

Alternative: Show both, i.e. BufferingWebSocket.url: UrlString (= string).

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:74
  • Comments:23 (2 by maintainers)

github_iconTop GitHub Comments

21reactions
plaacommented, May 15, 2021

@miyauchiakira True, just adding & {} (which does not change the type at all) causes TypeScript not to expand the type. I have no idea why this workaround works. Ugly, but effective – still would prefer TypeScript to “just work”.

15reactions
Polatritecommented, Apr 16, 2020

+1 for this.

In our project, I wanted to declare some semantic types representing numbers, to remove some of the ambiguity of “what does this random float value actually mean?”, so I added these type alias declarations:

type percentage = number
type timeInSeconds = number
type timeInMilliseconds = number
type radians = number
type degrees = number
type gameUnits = number

I was quite disappointed to see that the assorted tooltips/intellisense did not keep the alias in tact, and just resolved down to a number.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript type alias let Intellisense show alias name, not ...
Type aliases as their name suggests are just different names for another types. Type alias names are not something the compiler is ...
Read more >
Bug List - Bugs - Eclipse
Chandra, NEW, ---, PDE container does not resolve fragment if environment not set in target and target doesn't match running platform, 2022-11-19.
Read more >
Release 7.25.0 The IPython Development Team
This help to type unicode character that do not have short latex aliases, and have long unicode names. for example ,.
Read more >
npmsearchfullcat_npm143.txt - GitHub
=imzshh 2013-05-08 0.2.1 ach Connect middleware for setting Access-Control ... api-media-type A Node.js module exporting a map of common media type names…
Read more >
Blog | HHVM
To set up the VS Code based HHVM development environment on any Linux or macOS machines: Install Nix; Checkout HHVM with all submodules:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found