如何在 VSCode 中查看大型打字稿类型? [英] How do I view large typescript types in VSCode?

查看:30
本文介绍了如何在 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
}

这就是它在悬停时在 VSCode 中被缩短的方式:

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

如何查看隐藏部分?任何建议将不胜感激.

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.

推荐答案

有一个看似无关的编译器设置,称为 noErrorTruncation.它控制类型是否在错误中被截断.如果将此编译器选项设置为 true,它还将防止工具提示中的类型截断.

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.

这篇关于如何在 VSCode 中查看大型打字稿类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆