打字稿抱怨browser.params

时间:2016-08-25 20:45:28

标签: typescript protractor

IDE :Visual Studio代码

protractor.conf.js:

params: {
    test: true,
},

规格:

import {browser, element, by, $, $$} from 'protractor/globals';
class test{    
    if(browser.params.test === true){
        console.log('success');
    }
}

在运行npm run tsc时,它在IF语句中给出了错误error TS1005: ',' expected.

enter image description here

1 个答案:

答案 0 :(得分:1)

该课程无效。你的意思是在构造函数中运行if-block吗?

import {browser, element, by, $, $$} from 'protractor/globals';
class test {
    constructor() {
        if(browser.params.test === true){
            console.log('success');
        }
    }
}