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

Commit

Permalink
fix(types): do not publish built/globals.d.ts (#3546)
Browse files Browse the repository at this point in the history
- do not publish built/globals.d.ts
- remove type interface for HttpProxyAgent and set to to any
  • Loading branch information
cnishina committed Sep 14, 2016
1 parent 11c9418 commit 58459a9
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ gulp.task('checkVersion', function(done) {
});

gulp.task('built:copy', function(done) {
return gulp.src(['lib/**/*.js','lib/globals.d.ts','lib/index.d.ts'])
return gulp.src(['lib/**/*.js','lib/index.d.ts'])
.pipe(gulp.dest('built/'));
done();
});
Expand Down
22 changes: 16 additions & 6 deletions lib/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -679,8 +679,12 @@ export class ProtractorBrowser extends Webdriver {
let $timeout = $delegate;

let taskId = 0;
if (!window['NG_PENDING_TIMEOUTS']) {
window['NG_PENDING_TIMEOUTS'] = {};

interface Window {
[key: string]: any;
}
if (!(<Window>window)['NG_PENDING_TIMEOUTS']) {
(<Window>window)['NG_PENDING_TIMEOUTS'] = {};
}

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

taskId++;
let fn = args[0];
window['NG_PENDING_TIMEOUTS'][taskId] = fn.toString();
(<Window>window)['NG_PENDING_TIMEOUTS'][taskId] =
fn.toString();
let wrappedFn = ((taskId_: number) => {
return function() {
delete window['NG_PENDING_TIMEOUTS'][taskId_];
delete (
<Window>window)['NG_PENDING_TIMEOUTS'][taskId_];
return fn.apply(null, arguments);
};
})(taskId);
Expand All @@ -708,7 +714,7 @@ export class ProtractorBrowser extends Webdriver {
extendedTimeout.cancel = function() {
let taskId_ = arguments[0] && arguments[0].ptorTaskId_;
if (taskId_) {
delete window['NG_PENDING_TIMEOUTS'][taskId_];
delete (<Window>window)['NG_PENDING_TIMEOUTS'][taskId_];
}
return $timeout.cancel.apply($timeout, arguments);
};
Expand Down Expand Up @@ -1044,7 +1050,11 @@ export class ProtractorBrowser extends Webdriver {
let vm_ = require('vm');
let flow = webdriver.promise.controlFlow();

let context: Object = {require: require};
interface Context {
require: any;
[key: string]: any;
}
let context: Context = {require: require};
global.list = (locator: Locator) => {
/* globals browser */
return global.browser.findElements(locator).then(
Expand Down
2 changes: 1 addition & 1 deletion lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export interface Config {
* to generate the agent or use sauceProxy as an alternative. If a
* sauceProxy is provided, the sauceAgent will be overridden.
*/
sauceAgent?: HttpProxyAgent;
sauceAgent?: any;
/**
* Use sauceProxy if you are behind a corporate proxy to connect to
* saucelabs.com.
Expand Down
6 changes: 1 addition & 5 deletions lib/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ declare namespace angular {
var module: Function;
}

declare interface Object { [key: string]: any; }

declare interface Window { [key: string]: any; }
// declare interface Window { [key: string]: any; }

declare namespace NodeJS {
interface Process {
Expand Down Expand Up @@ -35,5 +33,3 @@ declare interface IError extends Error {
code?: number;
stack?: string;
}

declare interface HttpProxyAgent { constructor(opts: Object): HttpProxyAgent; }
1 change: 0 additions & 1 deletion lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference path="../typings/index.d.ts" />
/// <reference path="./globals.d.ts" />
export {ElementHelper, ProtractorBrowser} from './browser';
export {Config} from './config';
export {ElementArrayFinder, ElementFinder} from './element';
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dependencies": {
"@types/jasmine": "^2.2.31",
"@types/node": "^6.0.35",
"@types/q": "^0.0.30",
"adm-zip": "0.4.7",
"chalk": "^1.1.3",
"glob": "^7.0.3",
Expand All @@ -32,7 +33,6 @@
"@types/minimatch": "^2.0.28",
"@types/minimist": "^1.1.28",
"@types/optimist": "0.0.28",
"@types/q": "^0.0.30",
"body-parser": "~1.15.2",
"chai": "~3.5.0",
"chai-as-promised": "~5.3.0",
Expand Down

0 comments on commit 58459a9

Please sign in to comment.