代码之家  ›  专栏  ›  技术社区  ›  Norfeldt

Typescript元组lint错误不一致[vscode]

  •  0
  • Norfeldt  · 技术社区  · 7 年前

    this great video 关于如何在typescript中使用类型。

    但我注意到与我的文本编辑器的linting和视频不一致。

    视频是这样显示的

    enter image description here

    enter image description here

    enter image description here

    如果我更改了代码,因此它不应该忽略任何错误,我仍然会得到错误

    enter image description here

    这是怎么回事?

    我不知道这是否有关系,但我使用的是typescript 3.3.x,视频使用的是3.1.x

    1 回复  |  直到 7 年前
        1
  •  2
  •   tomermes    7 年前

    视频将阵列声明如下:

    const arr: myList = []
    

    你是这样宣布的:

    const arr: myList[] = []