Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I view large typescript types in VSCode?

I have a large type like this one:

type Large = {
    foo: 123,
    bar: 123,
    baz: 123
} | {
    foo: 123,
    bar: 123,
    baz: 123
} | {
    foo: 123,
    bar: 123,
    baz: 123
} | {
    foo: 123,
    bar: 123,
    baz: 123
} | {
    foo: 123,
    bar: 123,
    baz: 123
} | {
    foo: 123,
    bar: 123,
    baz: 123
} | {
    foo: 123,
    bar: 123,
    baz: 123
} | {
    foo: 123,
    bar: 123,
    baz: 123
} | {
    foo: 123,
    bar: 123,
    baz: 123
}

And this is how it gets shortened in VSCode when hovered:

enter image description here

How do I view the hidden part? Any suggestions would be appreciated.

P.S. Of course the type I am trying to view is not that simple and it's not statically written as well.

like image 571
Nurbol Alpysbayev Avatar asked Dec 28 '18 10:12

Nurbol Alpysbayev


People also ask

How do I change the view in VS Code?

The Activity Bar on the left lets you quickly switch between Views. You can also reorder Views by dragging and dropping them on the Activity Bar or remove a View entirely (right click Hide from Activity Bar).

Does VS Code support TypeScript?

Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler, tsc . You will need to install the TypeScript compiler either globally or in your workspace to transpile TypeScript source code to JavaScript ( tsc HelloWorld. ts ). You can test your install by checking the version.


1 Answers

There is a seemingly unrelated compiler setting called noErrorTruncation. It controls if types are truncated in errors. If you set this compiler option to true it will also prevent type truncation in tooltips.

Note This will prevent truncation of types (the ... part) it will not unfortunately force the expansion of mapped or conditional types.

like image 146
Titian Cernicova-Dragomir Avatar answered Sep 20 '22 21:09

Titian Cernicova-Dragomir