protractor icon indicating copy to clipboard operation
protractor copied to clipboard

Using protractor with typescript creates tsc warnings

Open cnishina opened this issue 10 years ago • 4 comments

tsc                                                                                                                                          ⏎
node_modules/protractor/globals.ts(22,37): error TS2304: Cannot find name 'global'.
node_modules/protractor/globals.ts(23,31): error TS2304: Cannot find name 'global'.
node_modules/protractor/globals.ts(24,37): error TS2304: Cannot find name 'global'.
node_modules/protractor/globals.ts(25,31): error TS2304: Cannot find name 'global'.
node_modules/protractor/globals.ts(26,31): error TS2304: Cannot find name 'global'.
node_modules/protractor/globals.ts(27,51): error TS2304: Cannot find name 'global'.
node_modules/protractor/globals.ts(28,57): error TS2304: Cannot find name 'global'.
node_modules/protractor/globals.ts(30,5): error TS2304: Cannot find name 'global'.

This might not be a bug if typings.json includes the DefinitelyTyped node ambient file. Should investigate post 4.0.2 release.

cnishina avatar Jul 28 '16 02:07 cnishina

After some investigation, this is not an issue. In the cookbook, the typings.json file was missing node. Having node in typings allows for 'global' to exist.

cnishina avatar Jul 28 '16 22:07 cnishina

Hi @cnishina ,

I have node in typings.json and it is still not finding 'global'.

ravitej-klair avatar Aug 23 '16 18:08 ravitej-klair

There is a fix. Although your typescript compiler is complaining, it should still work. https://github.com/angular/protractor/pull/3485

cnishina avatar Aug 23 '16 18:08 cnishina

@ravitej-klair It should work, I faced similar warnings and fixed them. Try uninstalling node typings and install it again. There is a catch- typings uninstall doesn't work same as install and it is not documented as well. I do it like this:

//create typings.json file in project
typings init 

//for installing ambient types
typings install --global --save dt~node

//for uninstalling
typings uninstall --global --save node

igniteram avatar Aug 23 '16 19:08 igniteram