gpt4 book ai didi

typescript - 从 Protractor 的 ElementFinder 类型继承而没有收到 typescript 警告

转载 作者:搜寻专家 更新时间:2023-10-30 21:53:11 26 4
gpt4 key购买 nike

尝试从 typescript 中的 Protractor extend ElementFinder 时收到编译警告。

package.json

"typescript": "^2.0.0-dev.20160707"
"typings": "^1.3.1"
"protractor": "3.3.0"

在我的项目中,我安装了typing definitions from definitely typed ,到目前为止一切正常。

但是,一旦我imported the ElementFinder class from protractor directly , 它开始引用 built 目录的 element.d.ts 文件来输入信息。出于某种原因,当源代码(甚至生成的 built/ javascript 中的文档!)说类型是 webdriver.promise.Promise

我在这个 typescript file that represents a datepicker in our component library 上收到以下编译警告.

node_modules/protractor/built/element.d.ts(58,31): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/element.d.ts(60,106): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/element.d.ts(222,24): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/element.d.ts(255,36): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/element.d.ts(280,54): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/element.d.ts(303,35): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/element.d.ts(336,37): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/element.d.ts(368,62): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/element.d.ts(642,37): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/protractor.d.ts(96,22): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/protractor.d.ts(201,57): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/protractor.d.ts(214,57): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/protractor.d.ts(221,93): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/protractor.d.ts(313,41): error TS2305: Module 'webdriver' has no exported member 'Promise'.
node_modules/protractor/built/protractor.d.ts(322,36): error TS2305: Module 'webdriver' has no exported member 'Promise'.

这很奇怪,因为我看到我的 rxDatePicker 实例显示了 ElementFinder 的所有方法和属性,所以正在创建生成的 javascript,我'我只是看到很多警告。

也许有一种方法可以忽略警告?有没有办法做到这一点?

最佳答案

如果您还没有找到它,这是临时解决方案:

在 package.json 中确保此行位于 2.44.* "@types/selenium-webdriver": "2.44.*",

关于typescript - 从 Protractor 的 ElementFinder 类型继承而没有收到 typescript 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38360177/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com