chore(build): enable type-checking for TypeScript ES6 emit.
This requires delicate handling of type definitions which collide, because we use TypeScript-provided lib.d.ts for --target=es5 and lib.es6.d.ts for --target=es6. We need to include our polyfill typings only in the --target=es5 case, and the usages have to be consistent with lib.es6.d.ts. Also starting with this change we now typecheck additional modules, so this fixes a bunch of wrong typings which were never checked before. Fixes #3178
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
/// <reference path="../../typings/es6-promise/es6-promise.d.ts" />
|
||||
|
||||
import {Map, List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {ResolvedBinding, Binding, Dependency, BindingBuilder, bind} from './binding';
|
||||
import {
|
||||
|
@ -1,4 +1,3 @@
|
||||
/// <reference path="../../typings/es6-promise/es6-promise.d.ts" />
|
||||
/// <reference path="../../typings/rx/rx.d.ts" />
|
||||
|
||||
import {global, isPresent} from 'angular2/src/facade/lang';
|
||||
@ -9,7 +8,7 @@ export {Promise};
|
||||
|
||||
export interface PromiseCompleter<R> {
|
||||
promise: Promise<R>;
|
||||
resolve: (value?: R | Thenable<R>) => void;
|
||||
resolve: (value?: R | PromiseLike<R>) => void;
|
||||
reject: (error?: any, stackTrace?: string) => void;
|
||||
}
|
||||
|
||||
@ -20,7 +19,8 @@ export class PromiseWrapper {
|
||||
|
||||
// Note: We can't rename this method into `catch`, as this is not a valid
|
||||
// method name in Dart.
|
||||
static catchError<T>(promise: Promise<T>, onError: (error: any) => T | Thenable<T>): Promise<T> {
|
||||
static catchError<T>(promise: Promise<T>,
|
||||
onError: (error: any) => T | PromiseLike<T>): Promise<T> {
|
||||
return promise.catch(onError);
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ export class PromiseWrapper {
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
static then<T, U>(promise: Promise<T>, success: (value: T) => U | Thenable<U>,
|
||||
rejection?: (error: any, stack?: any) => U | Thenable<U>): Promise<U> {
|
||||
static then<T, U>(promise: Promise<T>, success: (value: T) => U | PromiseLike<U>,
|
||||
rejection?: (error: any, stack?: any) => U | PromiseLike<U>): Promise<U> {
|
||||
return promise.then(success, rejection);
|
||||
}
|
||||
|
||||
@ -66,6 +66,7 @@ export class TimerWrapper {
|
||||
}
|
||||
|
||||
export class ObservableWrapper {
|
||||
// TODO(vsavkin): when we use rxnext, try inferring the generic type from the first arg
|
||||
static subscribe<T>(emitter: Observable, onNext: (value: T) => void,
|
||||
onThrow: (exception: any) => void = null,
|
||||
onReturn: () => void = null): Object {
|
||||
|
@ -9,7 +9,7 @@ export var StringMap = global.Object;
|
||||
// Map constructor. We work around that by manually adding the items.
|
||||
var createMapFromPairs: {(pairs: List<any>): Map<any, any>} = (function() {
|
||||
try {
|
||||
if (new Map([1, 2]).size === 2) {
|
||||
if (new Map([[1, 2]]).size === 1) {
|
||||
return function createMapFromPairs(pairs: List<any>):
|
||||
Map<any, any> { return new Map(pairs); };
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/// <reference path="../../typings/angular-protractor/angular-protractor.d.ts" />
|
||||
/// <reference path="../../typings/jasmine/jasmine"/>
|
||||
|
||||
import webdriver = require('selenium-webdriver');
|
||||
import * as webdriver from 'selenium-webdriver';
|
||||
|
||||
export var browser: protractor.IBrowser = global['browser'];
|
||||
export var $: cssSelectorHelper = global['$'];
|
||||
|
Reference in New Issue
Block a user