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

Commit 58459a9

Browse files
authored
fix(types): do not publish built/globals.d.ts (#3546)
- do not publish built/globals.d.ts - remove type interface for HttpProxyAgent and set to to any
1 parent 11c9418 commit 58459a9

File tree

6 files changed

+20
-15
lines changed

6 files changed

+20
-15
lines changed

gulpfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ gulp.task('checkVersion', function(done) {
5050
});
5151

5252
gulp.task('built:copy', function(done) {
53-
return gulp.src(['lib/**/*.js','lib/globals.d.ts','lib/index.d.ts'])
53+
return gulp.src(['lib/**/*.js','lib/index.d.ts'])
5454
.pipe(gulp.dest('built/'));
5555
done();
5656
});

lib/browser.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,12 @@ export class ProtractorBrowser extends Webdriver {
679679
let $timeout = $delegate;
680680

681681
let taskId = 0;
682-
if (!window['NG_PENDING_TIMEOUTS']) {
683-
window['NG_PENDING_TIMEOUTS'] = {};
682+
683+
interface Window {
684+
[key: string]: any;
685+
}
686+
if (!(<Window>window)['NG_PENDING_TIMEOUTS']) {
687+
(<Window>window)['NG_PENDING_TIMEOUTS'] = {};
684688
}
685689

686690
let extendedTimeout: any = function() {
@@ -691,10 +695,12 @@ export class ProtractorBrowser extends Webdriver {
691695

692696
taskId++;
693697
let fn = args[0];
694-
window['NG_PENDING_TIMEOUTS'][taskId] = fn.toString();
698+
(<Window>window)['NG_PENDING_TIMEOUTS'][taskId] =
699+
fn.toString();
695700
let wrappedFn = ((taskId_: number) => {
696701
return function() {
697-
delete window['NG_PENDING_TIMEOUTS'][taskId_];
702+
delete (
703+
<Window>window)['NG_PENDING_TIMEOUTS'][taskId_];
698704
return fn.apply(null, arguments);
699705
};
700706
})(taskId);
@@ -708,7 +714,7 @@ export class ProtractorBrowser extends Webdriver {
708714
extendedTimeout.cancel = function() {
709715
let taskId_ = arguments[0] && arguments[0].ptorTaskId_;
710716
if (taskId_) {
711-
delete window['NG_PENDING_TIMEOUTS'][taskId_];
717+
delete (<Window>window)['NG_PENDING_TIMEOUTS'][taskId_];
712718
}
713719
return $timeout.cancel.apply($timeout, arguments);
714720
};
@@ -1044,7 +1050,11 @@ export class ProtractorBrowser extends Webdriver {
10441050
let vm_ = require('vm');
10451051
let flow = webdriver.promise.controlFlow();
10461052

1047-
let context: Object = {require: require};
1053+
interface Context {
1054+
require: any;
1055+
[key: string]: any;
1056+
}
1057+
let context: Context = {require: require};
10481058
global.list = (locator: Locator) => {
10491059
/* globals browser */
10501060
return global.browser.findElements(locator).then(

lib/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export interface Config {
100100
* to generate the agent or use sauceProxy as an alternative. If a
101101
* sauceProxy is provided, the sauceAgent will be overridden.
102102
*/
103-
sauceAgent?: HttpProxyAgent;
103+
sauceAgent?: any;
104104
/**
105105
* Use sauceProxy if you are behind a corporate proxy to connect to
106106
* saucelabs.com.

lib/globals.d.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ declare namespace angular {
33
var module: Function;
44
}
55

6-
declare interface Object { [key: string]: any; }
7-
8-
declare interface Window { [key: string]: any; }
6+
// declare interface Window { [key: string]: any; }
97

108
declare namespace NodeJS {
119
interface Process {
@@ -35,5 +33,3 @@ declare interface IError extends Error {
3533
code?: number;
3634
stack?: string;
3735
}
38-
39-
declare interface HttpProxyAgent { constructor(opts: Object): HttpProxyAgent; }

lib/index.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// <reference path="../typings/index.d.ts" />
2-
/// <reference path="./globals.d.ts" />
32
export {ElementHelper, ProtractorBrowser} from './browser';
43
export {Config} from './config';
54
export {ElementArrayFinder, ElementFinder} from './element';

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"dependencies": {
1515
"@types/jasmine": "^2.2.31",
1616
"@types/node": "^6.0.35",
17+
"@types/q": "^0.0.30",
1718
"adm-zip": "0.4.7",
1819
"chalk": "^1.1.3",
1920
"glob": "^7.0.3",
@@ -32,7 +33,6 @@
3233
"@types/minimatch": "^2.0.28",
3334
"@types/minimist": "^1.1.28",
3435
"@types/optimist": "0.0.28",
35-
"@types/q": "^0.0.30",
3636
"body-parser": "~1.15.2",
3737
"chai": "~3.5.0",
3838
"chai-as-promised": "~5.3.0",

0 commit comments

Comments
 (0)