Better display representation for intersection types
See original GitHub issueI’m not sure if this has been discussed before, but join types are mostly unreadable. I think the type should be prettified somehow before being displayed to the user.
TypeScript Version:
1.8
Code
type T1 = {};
type T2 = {test: number};
type J = T1 & T2;
Expected behavior:
var x: J;
typeof x; // {test: number}
Actual behavior:
var x: J;
typeof x; // {} & {test: number}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Discussion: Union and Intersection types #399 - GitHub
In my opinion, Union types will be more useful and hence should be looked into at ... for mapping between the structures and...
Read more >Is it possible to display the full computed type of a typescript ...
Similarly, if you have an intersection of two types then sometimes it will just display it as Type1 & Type2 instead of displaying...
Read more >[1911.01899] Non-idempotent intersection types in logical form
Abstract: Intersection types are an essential tool in the analysis of operational and denotational properties of lambda-terms and functional ...
Read more >Pregrammars and Intersection Types - DROPS
A representation of intersection types in terms of pregrammars is presented. Pregrammar based rewriting relations, corresponding respectively to type ...
Read more >Signalized Intersections Informational Guide, Second Edition
Provide bike lanes. Intersection-Wide. Treatments. (Chapter 9). • Modify stop line location. • Improve pedestrian signal display. • Modify pedestrian signal.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The second actually.
Accepting PRs, with a big caveat. This is actually quite a bit trickier than it appears because of how the compiler handles anonymous self-referential types. A PR here should be accompanied by a large test suite of recursively self-referential types to ensure there aren’t any lingering runaway recursion bugs.
See also comments in #8228.