【问题标题】:How do I look at [...more] in detail?我如何详细了解[...更多]?
【发布时间】:2019-10-28 15:31:22
【问题描述】:
import * as Joi from 'joi';
import 'joi-extract-type';

const schema = {
    aaaaaaa: Joi.number()
        .integer()
        .positive()
        .allow(null),
    bbbbbb: Joi.number()
        .integer()
        .positive()
        .allow(null),
    aaaaaaa3: Joi.number()
        .integer()
        .positive()
        .allow(null),
    aaaaaaa5: Joi.number()
        .integer()
        .positive()
        .allow(null),
    e: Joi.number()
        .integer()
        .positive()
        .allow(null),
    f: Joi.number()
        .integer()
        .positive()
        .allow(null),
    g: Joi.number()
        .integer()
        .positive()
        .allow(null),
    h: Joi.number()
        .integer()
        .positive()
        .allow(null),
    i: Joi.number()
        .integer()
        .positive()
        .allow(null),
    j: Joi.number()
        .integer()
        .positive()
        .allow(null),
    k: Joi.number()
        .integer()
        .positive()
        .allow(null),
    n: Joi.number()
        .integer()
        .positive()
        .allow(null),
    nnnnnnnnn: Joi.number()
        .integer()
        .positive()
        .allow(null),
};

type exampleType = Joi.extractType<typeof schema>;

如何详细了解 [...more]?

无论我怎么看,我都找不到。 我想看看那个。 因为我做了很多组合。 然后有20多个。 很难检查类型,因为它显示 [...更多]。

enter image description here

【问题讨论】:

  • 请不要将代码发布为图片
  • 你在哪里看到的?
  • 哦,抱歉...我只想详细了解 [...更多]。很难知道类型是什么,因为它不止于此。
  • 智能感知窗口正在缩短,因为条目太多,这是 vs-code 的限制。我相信有一些选项可以允许更大的弹出窗口,但你必须自己重新设计。作为一种快速解决方法,您可以尝试使用点符号来访问单个项目,例如 declare x: exampleType; x.&lt;variable-name&gt; 在其中将 &lt;variable-name&gt; 替换为您要查找的属性。然后将鼠标悬停在变量上以查看其类型

标签: typescript visual-studio-code


【解决方案1】:

VS Code 的 JavaScript 和 TypeScript IntelliSense 会截断很长的类型,因为它们通常没用(实际上经常会带来更多的混乱)。这就是您看到... more ... 部分的原因

从 VS Code 1.36 开始,无法强制显示完整类型。我们有一个关于 interactive diagnostics 的问题,它讨论了如何动态扩展诊断中的类型,这对 IntelliSense 也是有意义的。

如果您认为您的具体案例可以通过 TypeScript 更好地处理,请file an issue

【讨论】:

    猜你喜欢
    • 2014-10-05
    • 2020-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-11
    • 2019-11-08
    • 2021-05-26
    • 1970-01-01
    相关资源
    最近更新 更多