Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 0ad2381

Browse files
authored
fix(types): Fix types for TS 2.0 (#4072)
1 parent 3edd62e commit 0ad2381

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

lib/debugger.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ export class DebugHelper {
162162
let execFn_ = () => {
163163
// Run code through vm so that we can maintain a local scope which is
164164
// isolated from the rest of the execution.
165-
let res;
165+
let res: wdpromise.Promise<any>;
166166
try {
167167
res = vm_.runInContext(code, sandbox);
168168
} catch (e) {
169-
res = 'Error while evaluating command: ' + e;
169+
res = wdpromise.when('Error while evaluating command: ' + e);
170170
}
171171
if (!wdpromise.isPromise(res)) {
172172
res = wdpromise.when(res);

lib/element.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let clientSideScripts = require('./clientsidescripts');
1111
let logger = new Logger('element');
1212

1313
export class WebdriverWebElement {}
14-
export interface WebdriverWebElement extends WebElement {}
14+
export interface WebdriverWebElement extends WebElement { [key: string]: any; }
1515

1616
let WEB_ELEMENT_FUNCTIONS = [
1717
'click', 'sendKeys', 'getTagName', 'getCssValue', 'getAttribute', 'getText', 'getSize',
@@ -88,7 +88,7 @@ export class ElementArrayFinder extends WebdriverWebElement {
8888

8989
// TODO(juliemr): might it be easier to combine this with our docs and just
9090
// wrap each one explicity with its own documentation?
91-
WEB_ELEMENT_FUNCTIONS.forEach((fnName: keyof WebdriverWebElement) => {
91+
WEB_ELEMENT_FUNCTIONS.forEach((fnName: string) => {
9292
this[fnName] = (...args: any[]) => {
9393
let actionFn = (webElem: any) => {
9494
return webElem[fnName].apply(webElem, args);
@@ -867,7 +867,7 @@ export class ElementFinder extends WebdriverWebElement {
867867
this.browser_, getWebElements, elementArrayFinder.locator(),
868868
elementArrayFinder.actionResults_);
869869

870-
WEB_ELEMENT_FUNCTIONS.forEach((fnName: keyof WebdriverWebElement) => {
870+
WEB_ELEMENT_FUNCTIONS.forEach((fnName: string) => {
871871
(this)[fnName] = (...args: any[]) => {
872872
return (this.elementArrayFinder_)[fnName]
873873
.apply(this.elementArrayFinder_, args)

lib/plugins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ export class Plugins {
438438
*/
439439
private safeCallPluginFun(
440440
pluginObj: ProtractorPlugin, funName: string, args: any[], promiseType: PromiseType,
441-
failReturnVal: any) {
441+
failReturnVal: any): q.Promise<any>|Promise<any>|webdriver.promise.Promise<any> {
442442
const resolver = (done: (result: any) => void) => {
443443
const logError = (e: any) => {
444444
if (this.resultsReported) {

0 commit comments

Comments
 (0)