Typescript: lib / lib.d.ts错误找不到名称“对象”。

创建于 2017-03-14  ·  3评论  ·  资料来源: microsoft/TypeScript

TypeScript版本: 2.2.1

使用gulp打字稿和最新版本的打字稿2.2.1会引发错误:

typescript/lib/lib.d.ts(163,15): error TS2304: Cannot find name 'object'.
typescript/lib/lib.d.ts(170,15): error TS2304: Cannot find name 'object'.

预期行为:
编译没有错误

实际行为:

typescript/lib/lib.d.ts(163,15): error TS2304: Cannot find name 'object'.
typescript/lib/lib.d.ts(170,15): error TS2304: Cannot find name 'object'.

->将行重命名为以下内​​容(只是将对象更改为Object)解决了编译错误

create(o: Object | null): any;

    /**
      * Creates an object that has the specified prototype, and that optionally contains specified properties.
      * <strong i="18">@param</strong> o Object to use as a prototype. May be null
      * <strong i="19">@param</strong> properties JavaScript object that contains one or more property descriptors.
      */
    create(o: Object | null, properties: PropertyDescriptorMap): any;
Question

最有用的评论

object是TS2.2中的关键字。 是否有可能使用与您获得lib的版本不同的版本进行编译?

所有3条评论

object是TS2.2中的关键字。 是否有可能使用与您获得lib的版本不同的版本进行编译?

我在我的包中发现了一些错误,json(在dev和“ normal”依赖项中有两次输入)->修复了该问题,然后重新安装了所有包->现在似乎可以使用了。
谢谢你的提示

👍谢谢@ andy-ms

此页面是否有帮助?
0 / 5 - 0 等级