Issue 1:
I am converting a Protractor page object library from JavaScript to Typescript. I have a static utility method that refreshes until an element is present (or the timeout limit is reached).

For some reason, I am unable to use a boolean valued promise as a thenable construct and I can't figure out why. The error message is Error:(102, 50) TS2345:Argument of type '(isEnabled: boolean) => Promise | undefined' is not assignable to parameter of type '((value: boolean) => CloudletPolicyBean | IThenable) | undefined'.

Type '(isEnabled: boolean) => Promise | undefined' is not assignable to type '(value: boolean) => CloudletPolicyBean | IThenable'.

Type 'Promise | undefined' is not assignable to type 'CloudletPolicyBean | IThenable'.

Type 'undefined' is not assignable to type 'CloudletPolicyBean | IThenable'.

The source code is below with comment showing where the compile error occurs.

This was asked in SO and people there have commented that this is indeed a error with type definition for webdriver. Can someone here please take a look.

selenium-webdriver types used: 3.0.4

node:6.9.5

protractor:5.1.2

import {browser, element, ElementFinder, ExpectedConditions} from 'protractor';
import * as wd from 'selenium-webdriver';
import {By} from "selenium-webdriver";

export class ExtendedExpectedConditions {

public static refreshUntilElementIsPresent(element: ElementFinder, numberOfSeconds: number = 30000,
refreshInterval: number = 5000): void {
this.refreshElement(element, numberOfSeconds, refreshInterval);
}

protected static refreshElement(element: ElementFinder, numberOfSeconds: number = 30000, refreshInterval:
number = 5000) {

//This line throws the compile error
element.isPresent().then(value => {
if (!value) {
if (numberOfSeconds <= 0) {
return new wd.promise.Promise(function (resolve, reject) {
reject('Element cannot be found after expected retry numbers');
})
}
browser.sleep(refreshInterval).then(() => {
browser.refresh().then(() => this.refreshUntilElementIsPresent(element, numberOfSeconds -
(refreshInterval / 1000)));
});
}
});
}
}

Issue 2:
I tried using the latest mocha/index.d.ts file in this repo and had problems.

I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript

I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).

I want to talk about mocha/index.d.ts.

The authors of that type definition are cc/ @vvakame, @ligaz,

I've started a new angular2 project and included the following dev dependency:

"@types/mocha": "2.2.33",

It installs correctly however when I run:

webpack --config webpack.config.dev.js --progress --profile --watch

I get:

[at-loader] node_modules/@types/jasmine/index.d.ts:15:18
Duplicate identifier 'xit'.

[at-loader] node_modules/@types/mocha/index.d.ts:33:13
Duplicate identifier 'describe'.

[at-loader] node_modules/@types/mocha/index.d.ts:34:13
Duplicate identifier 'xdescribe'.

[at-loader] node_modules/@types/mocha/index.d.ts:39:13
Duplicate identifier 'it'.

[at-loader] node_modules/@types/mocha/index.d.ts:40:13
Duplicate identifier 'xit'.

My webpack config file:

var webpack = require('webpack');

module.exports = {
devtool: 'cheap-module-eval-source-map',

output: {
path: './public/js/app',
publicPath: "/js/app/",
filename: 'bundle.js',
chunkFilename: '[id].chunk.js'
},
entry: {
'app': './assets/app/main.polymer.ts'
},

resolve: {
extensions: ['.js', '.ts']
},

module: {
loaders: [
{
test: /\.ts$/,
loaders: [
'awesome-typescript-loader',
'angular2-template-loader',
'angular2-router-loader'
]
},
{
test: /\.html$/,
loader: 'html'
},
{
test: /\.css$/,
loader: 'raw'
}
]
},

plugins: [
new webpack.ContextReplacementPlugin(
// The (\\|\/) piece accounts for path separators in *nix and Windows
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
'./src' // location of your src
)
]
};

Same thing happens with @types/jasmine. Maybe there is a relation?