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

Commit dc840fe

Browse files
committed
chore(typings): remove ptor from gulp types
- after investigation, variables in the namespace cannot be assigned a value - types will require import of the classes and then setting the value from global ``` import {Browser} from 'protractor'; var browser: Browser = global['browser']; ```
1 parent 248ed99 commit dc840fe

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gulpfile.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ gulp.task('default',['prepublish']);
7272

7373
gulp.task('types', function(done) {
7474
var folder = 'built';
75-
var files = ['ptor', 'browser', 'element', 'locators', 'expectedConditions'];
75+
var files = ['browser', 'element', 'locators', 'expectedConditions'];
7676
var outputFile = path.resolve(folder, 'index.d.ts');
7777
var contents = '';
78+
contents += 'declare namespace protractor {\n';
7879
files.forEach(file => {
7980
contents += parseTypingsFile(folder, file);
8081
});
82+
contents += '}\n';
8183

8284
// add module declaration
8385
contents += 'declare module "protractor" {\n';
@@ -104,6 +106,9 @@ var parseTypingsFile = function(folder, file) {
104106
if (line.indexOf('export') !== -1) {
105107
line = line.replace('export', '').trim();
106108
}
109+
if (line.indexOf('declare') !== -1) {
110+
line = line.replace('declare', '').trim();
111+
}
107112

108113
// Remove webdriver types and plugins for now
109114
line = removeTypes(line,'webdriver.ActionSequence');
@@ -115,7 +120,6 @@ var parseTypingsFile = function(folder, file) {
115120
line = removeTypes(line,'Plugins');
116121
contents += line + '\n';
117122
}
118-
119123
}
120124
return contents;
121125
}

0 commit comments

Comments
 (0)