Microsoft/TypeScript

Better display representation for intersection types

Open

#7,705 opened on Mar 27, 2016

View on GitHub
 (7 comments) (3 reactions) (0 assignees)TypeScript (48,455 stars) (6,726 forks)batch import
Effort: DifficultHelp WantedSuggestion

Description

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}

Contributor guide