Microsoft/TypeScript

Better display representation for intersection types

Aperta

#7705 aperta il 27 mar 2016

 (7 commenti) (3 reazioni) (0 assegnatari)TypeScript (13.395 fork)batch import
Effort: DifficultHelp WantedSuggestion

Metriche repository

Star
 (108.860 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

I'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}

Guida contributor