diff --git a/gulpfile.js b/gulpfile.js
index f5e847e71..373d6becb 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -72,12 +72,14 @@ gulp.task('default',['prepublish']);
gulp.task('types', function(done) {
var folder = 'built';
- var files = ['ptor', 'browser', 'element', 'locators', 'expectedConditions'];
+ var files = ['browser', 'element', 'locators', 'expectedConditions'];
var outputFile = path.resolve(folder, 'index.d.ts');
var contents = '';
+ contents += 'declare namespace protractor {\n';
files.forEach(file => {
contents += parseTypingsFile(folder, file);
});
+ contents += '}\n';
// add module declaration
contents += 'declare module "protractor" {\n';
@@ -104,6 +106,9 @@ var parseTypingsFile = function(folder, file) {
if (line.indexOf('export') !== -1) {
line = line.replace('export', '').trim();
}
+ if (line.indexOf('declare') !== -1) {
+ line = line.replace('declare', '').trim();
+ }
// Remove webdriver types and plugins for now
line = removeTypes(line,'webdriver.ActionSequence');
@@ -115,7 +120,6 @@ var parseTypingsFile = function(folder, file) {
line = removeTypes(line,'Plugins');
contents += line + '\n';
}
-
}
return contents;
}
diff --git a/scripts/typings_tests/test_fail_browser.ts b/scripts/typings_tests/test_fail_browser.ts
index e27ec5674..cb87be9d6 100644
--- a/scripts/typings_tests/test_fail_browser.ts
+++ b/scripts/typings_tests/test_fail_browser.ts
@@ -1,5 +1,6 @@
///
-import {browser} from 'protractor';
+import {Browser} from 'protractor';
+let browser: Browser;
browser.getProcessedConfig(0);
browser.getProcessedConfig('1');
browser.getProcessedConfig(true);
diff --git a/scripts/typings_tests/test_fail_by.ts b/scripts/typings_tests/test_fail_by.ts
index 9f08d90ce..b44ef02a7 100644
--- a/scripts/typings_tests/test_fail_by.ts
+++ b/scripts/typings_tests/test_fail_by.ts
@@ -1,5 +1,7 @@
///
-import {by, By} from 'protractor';
+import {ProtractorBy} from 'protractor';
+let by: ProtractorBy;
+let By: ProtractorBy;
by.addLocator(0, () => {});
by.addLocator(() => {}, () => {});
by.addLocator('', () => {}, () => {});
diff --git a/scripts/typings_tests/test_fail_elements.ts b/scripts/typings_tests/test_fail_elements.ts
index c6864c0d8..a93268e96 100644
--- a/scripts/typings_tests/test_fail_elements.ts
+++ b/scripts/typings_tests/test_fail_elements.ts
@@ -1,5 +1,9 @@
///
-import {element, by, $, $$} from 'protractor';
+import {ElementArrayFinder, ElementFinder, ElementHelper, ProtractorBy} from 'protractor';
+let element: ElementHelper;
+let by: ProtractorBy;
+let $: (search: string) => ElementFinder;
+let $$: (search: string) => ElementArrayFinder;
element.all(by.css('')).clone('clone');
element.all(by.css('')).clone(1);
element.all(by.css('')).clone(false);
diff --git a/scripts/typings_tests/test_fail_expected_conditions.ts b/scripts/typings_tests/test_fail_expected_conditions.ts
index cf1071453..87ba9c5e8 100644
--- a/scripts/typings_tests/test_fail_expected_conditions.ts
+++ b/scripts/typings_tests/test_fail_expected_conditions.ts
@@ -1,5 +1,6 @@
///
-import {element, by, ExpectedConditions} from 'protractor';
+import {ExpectedConditions_} from 'protractor';
+let ExpectedConditions: ExpectedConditions_;
ExpectedConditions.not(0);
ExpectedConditions.not('1');
ExpectedConditions.not(true);
diff --git a/scripts/typings_tests/test_pass.ts b/scripts/typings_tests/test_pass.ts
index ddbfb7f95..378c6d872 100644
--- a/scripts/typings_tests/test_pass.ts
+++ b/scripts/typings_tests/test_pass.ts
@@ -1,5 +1,12 @@
///
-import {browser, element, by, By, $, $$, ExpectedConditions} from 'protractor';
+import {Browser, ElementArrayFinder, ElementFinder, ElementHelper, ExpectedConditions_, ProtractorBy} from 'protractor';
+let browser: Browser;
+let by: ProtractorBy;
+let By: ProtractorBy;
+let element: ElementHelper;
+let $: (search: string) => ElementFinder;
+let $$: (search: string) => ElementArrayFinder;
+let ExpectedConditions: ExpectedConditions_;
element.all(by.css('')).clone();
element.all(by.css('')).then(() => {}, () => {}); // this is not appearing on the website
element.all(by.css('')).filter(() => {});
diff --git a/scripts/typings_tests/test_typings.js b/scripts/typings_tests/test_typings.js
index 44f4ed5c1..c5a678685 100644
--- a/scripts/typings_tests/test_typings.js
+++ b/scripts/typings_tests/test_typings.js
@@ -75,10 +75,10 @@ var testPassing = function(file) {
// The tests:
-testFailures('test_fail_elements.ts', 3, 478);
-testFailures('test_fail_browser.ts', 3, 93);
-testFailures('test_fail_expected_conditions.ts', 3, 24);
-testFailures('test_fail_by.ts', 3, 207);
+testFailures('test_fail_browser.ts', 4, 94);
+testFailures('test_fail_by.ts', 5, 209);
+testFailures('test_fail_elements.ts', 7, 482);
+testFailures('test_fail_expected_conditions.ts', 4, 25);
testPassing('test_pass.ts');
// Test evaluation and exiting: