From 643c71740e9e0a325f2f3b8431eb5f67cd84ba56 Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Thu, 6 Aug 2015 09:52:33 -0700 Subject: [PATCH] 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 --- modules/angular2/globals.d.ts | 3 --- modules/angular2/src/di/injector.ts | 2 -- modules/angular2/src/facade/async.ts | 11 +++++----- modules/angular2/src/facade/collection.ts | 2 +- modules/angular2/src/test_lib/e2e_util.ts | 2 +- modules/angular2/traceur-runtime.d.ts | 16 ++++++++++++++ modules/angular2/tsd.json | 2 +- .../src/components/grid_list/grid_list.ts | 4 ++-- .../src/components/input/input.ts | 3 ++- .../src/naive_infinite_scroll/common.ts | 6 ++--- .../src/naive_infinite_scroll/index.ts | 2 +- modules/benchmarks/src/tree/tree_benchmark.ts | 2 +- .../src/compiler/compiler_benchmark.ts | 4 ++-- .../src/largetable/largetable_benchmark.ts | 2 +- .../src/static_tree/tree_benchmark.ts | 2 +- .../src/tree/react/react.min.d.ts | 2 ++ .../src/tree/tree_benchmark.ts | 2 +- modules/benchpress/index.ts | 2 +- .../webdriver/selenium_webdriver_adapter.ts | 8 ++++--- modules/examples/src/http/http_comp.ts | 5 +++-- modules/examples/src/http/index.ts | 2 +- modules/examples/src/jsonp/index.ts | 2 +- modules/examples/src/jsonp/jsonp_comp.ts | 6 ++--- .../examples/src/model_driven_forms/index.ts | 11 +--------- .../examples/src/order_management/index.ts | 1 - .../examples/src/person_management/index.ts | 1 - modules/examples/src/routing/inbox-app.ts | 5 +++-- .../src/template_driven_forms/index.ts | 1 - modules/examples/src/todo/index.ts | 2 +- .../examples/src/todo/services/TodoStore.ts | 4 ++-- .../src/web_workers/todo/index_common.ts | 2 +- .../web_workers/todo/services/TodoStore.ts | 4 ++-- npm-shrinkwrap.clean.json | 6 +---- npm-shrinkwrap.json | 20 +++++++---------- tools/broccoli/trees/browser_tree.ts | 22 ++++++++++++------- 35 files changed, 88 insertions(+), 83 deletions(-) create mode 100644 modules/benchmarks_external/src/tree/react/react.min.d.ts diff --git a/modules/angular2/globals.d.ts b/modules/angular2/globals.d.ts index ee3388ea4b..4e45e219f9 100644 --- a/modules/angular2/globals.d.ts +++ b/modules/angular2/globals.d.ts @@ -3,7 +3,6 @@ */ /// -/// declare var assert: any; declare type int = number; @@ -32,5 +31,3 @@ interface BrowserNodeGlobal { setInterval: Function; clearInterval: Function; } - -declare var global: any; diff --git a/modules/angular2/src/di/injector.ts b/modules/angular2/src/di/injector.ts index 8b0f9b56c3..b522b8f6e9 100644 --- a/modules/angular2/src/di/injector.ts +++ b/modules/angular2/src/di/injector.ts @@ -1,5 +1,3 @@ -/// - import {Map, List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection'; import {ResolvedBinding, Binding, Dependency, BindingBuilder, bind} from './binding'; import { diff --git a/modules/angular2/src/facade/async.ts b/modules/angular2/src/facade/async.ts index 613bff2497..17c9273acc 100644 --- a/modules/angular2/src/facade/async.ts +++ b/modules/angular2/src/facade/async.ts @@ -1,4 +1,3 @@ -/// /// import {global, isPresent} from 'angular2/src/facade/lang'; @@ -9,7 +8,7 @@ export {Promise}; export interface PromiseCompleter { promise: Promise; - resolve: (value?: R | Thenable) => void; + resolve: (value?: R | PromiseLike) => 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(promise: Promise, onError: (error: any) => T | Thenable): Promise { + static catchError(promise: Promise, + onError: (error: any) => T | PromiseLike): Promise { return promise.catch(onError); } @@ -29,8 +29,8 @@ export class PromiseWrapper { return Promise.all(promises); } - static then(promise: Promise, success: (value: T) => U | Thenable, - rejection?: (error: any, stack?: any) => U | Thenable): Promise { + static then(promise: Promise, success: (value: T) => U | PromiseLike, + rejection?: (error: any, stack?: any) => U | PromiseLike): Promise { 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(emitter: Observable, onNext: (value: T) => void, onThrow: (exception: any) => void = null, onReturn: () => void = null): Object { diff --git a/modules/angular2/src/facade/collection.ts b/modules/angular2/src/facade/collection.ts index feea9a14a1..cb3ba1cac9 100644 --- a/modules/angular2/src/facade/collection.ts +++ b/modules/angular2/src/facade/collection.ts @@ -9,7 +9,7 @@ export var StringMap = global.Object; // Map constructor. We work around that by manually adding the items. var createMapFromPairs: {(pairs: List): Map} = (function() { try { - if (new Map([1, 2]).size === 2) { + if (new Map([[1, 2]]).size === 1) { return function createMapFromPairs(pairs: List): Map { return new Map(pairs); }; } diff --git a/modules/angular2/src/test_lib/e2e_util.ts b/modules/angular2/src/test_lib/e2e_util.ts index 4a5d56d8e2..33cefe95e6 100644 --- a/modules/angular2/src/test_lib/e2e_util.ts +++ b/modules/angular2/src/test_lib/e2e_util.ts @@ -2,7 +2,7 @@ /// /// -import webdriver = require('selenium-webdriver'); +import * as webdriver from 'selenium-webdriver'; export var browser: protractor.IBrowser = global['browser']; export var $: cssSelectorHelper = global['$']; diff --git a/modules/angular2/traceur-runtime.d.ts b/modules/angular2/traceur-runtime.d.ts index 9ccbc4aed7..8f78106a74 100644 --- a/modules/angular2/traceur-runtime.d.ts +++ b/modules/angular2/traceur-runtime.d.ts @@ -1,3 +1,19 @@ +// This file is used for TypeScript compilation to ES5 only. +// Since this file is not included in the compilation to ES6, it is an error +// to this file from other sources. +// Instead it is referenced by the rootFilePaths option to the compiler. + +// We also want the following typings to be available only when compiling to +// ES5, because they are redundant with lib.es6.d.ts. +/// + +// es6-promise.d.ts chose a different name for this interface than TS lib.es6.d.ts +// Generic Type Alises are in TS 1.6 (https://github.com/Microsoft/TypeScript/pull/3397) +// So we cannot write: +// declare type PromiseLike = Thenable; +// Until then we use a workaround: +interface PromiseLike extends Thenable {} + // Extend the ES5 standard library with some ES6 features we polyfill at runtime // by loading traceur-runtime.js diff --git a/modules/angular2/tsd.json b/modules/angular2/tsd.json index 46b416eb8e..97e5651f0c 100644 --- a/modules/angular2/tsd.json +++ b/modules/angular2/tsd.json @@ -15,7 +15,7 @@ "commit": "055b3172e8eb374a75826710c4d08677872620d3" }, "node/node.d.ts": { - "commit": "d5f92f93bdb49f332fa662ff1d0cc8700f02e4dc" + "commit": "51738fdf1643d269067861b405e87503b7479236" }, "rx/rx.d.ts": { "commit": "3882d337bb0808cde9fe4c08012508a48c135482" diff --git a/modules/angular2_material/src/components/grid_list/grid_list.ts b/modules/angular2_material/src/components/grid_list/grid_list.ts index cf6dd4e0a2..450b913bff 100644 --- a/modules/angular2_material/src/components/grid_list/grid_list.ts +++ b/modules/angular2_material/src/components/grid_list/grid_list.ts @@ -260,7 +260,7 @@ export class MdGridTile { } set rowspan(value) { - this._rowspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value; + this._rowspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value; } get rowspan() { @@ -268,7 +268,7 @@ export class MdGridTile { } set colspan(value) { - this._colspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value; + this._colspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value; } get colspan() { diff --git a/modules/angular2_material/src/components/input/input.ts b/modules/angular2_material/src/components/input/input.ts index 4123bc625a..a8a1cf9cbf 100644 --- a/modules/angular2_material/src/components/input/input.ts +++ b/modules/angular2_material/src/components/input/input.ts @@ -49,7 +49,8 @@ export class MdInputContainer { // classes based on the input state. ObservableWrapper.subscribe(input.mdChange, value => { this.inputHasValue = value != ''; }); - ObservableWrapper.subscribe(input.mdFocusChange, hasFocus => {this.inputHasFocus = hasFocus}); + ObservableWrapper.subscribe(input.mdFocusChange, + hasFocus => this.inputHasFocus = hasFocus); } } diff --git a/modules/benchmarks/src/naive_infinite_scroll/common.ts b/modules/benchmarks/src/naive_infinite_scroll/common.ts index 8858cd3c1e..eb82453836 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/common.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/common.ts @@ -66,7 +66,7 @@ export class RawEntity { var pieces = key.split('.'); var last = ListWrapper.last(pieces); pieces.length = pieces.length - 1; - var target = _resolve(pieces, this); + var target = this._resolve(pieces, this); if (target == null) { return null; } @@ -81,7 +81,7 @@ export class RawEntity { var pieces = key.split('.'); var last = ListWrapper.last(pieces); pieces.length = pieces.length - 1; - var target = _resolve(pieces, this); + var target = this._resolve(pieces, this); target[last] = value; } @@ -92,7 +92,7 @@ export class RawEntity { var pieces = key.split('.'); var last = ListWrapper.last(pieces); pieces.length = pieces.length - 1; - var target = _resolve(pieces, this); + var target = this._resolve(pieces, this); return target.remove(last); } diff --git a/modules/benchmarks/src/naive_infinite_scroll/index.ts b/modules/benchmarks/src/naive_infinite_scroll/index.ts index 944285eb6c..29e5a7df74 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/index.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/index.ts @@ -9,6 +9,6 @@ export function main() { bootstrap(App, createBindings()); } -function createBindings(): List { +function createBindings(): List { return [bind(APP_VIEW_POOL_CAPACITY).toValue(100000)]; } diff --git a/modules/benchmarks/src/tree/tree_benchmark.ts b/modules/benchmarks/src/tree/tree_benchmark.ts index 61a21abb91..c305a202c0 100644 --- a/modules/benchmarks/src/tree/tree_benchmark.ts +++ b/modules/benchmarks/src/tree/tree_benchmark.ts @@ -207,7 +207,7 @@ class BaseLineIf { this.component = null; } if (this.condition) { - var element = DOM.firstChild(DOM.clone(BASELINE_IF_TEMPLATE).content); + var element = DOM.firstChild((DOM.clone(BASELINE_IF_TEMPLATE)).content); this.anchor.parentNode.insertBefore(element, DOM.nextSibling(this.anchor)); this.component = new BaseLineTreeComponent(DOM.firstChild(element)); } diff --git a/modules/benchmarks_external/src/compiler/compiler_benchmark.ts b/modules/benchmarks_external/src/compiler/compiler_benchmark.ts index c87eb154aa..86ae0bc866 100644 --- a/modules/benchmarks_external/src/compiler/compiler_benchmark.ts +++ b/modules/benchmarks_external/src/compiler/compiler_benchmark.ts @@ -1,6 +1,6 @@ // compiler benchmark in AngularJS 1.x import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util'; -import angular = require("angular"); +declare var angular: any; export function main() { var ngEl = document.createElement('div'); @@ -9,7 +9,7 @@ export function main() { function loadTemplate(templateId, repeatCount) { var template = document.querySelectorAll(`#${templateId}`)[0]; - var content = template.innerHTML; + var content = (template).innerHTML; var result = ''; for (var i = 0; i < repeatCount; i++) { result += content; diff --git a/modules/benchmarks_external/src/largetable/largetable_benchmark.ts b/modules/benchmarks_external/src/largetable/largetable_benchmark.ts index 792c14aa7d..17813639c4 100644 --- a/modules/benchmarks_external/src/largetable/largetable_benchmark.ts +++ b/modules/benchmarks_external/src/largetable/largetable_benchmark.ts @@ -3,7 +3,7 @@ import { getStringParameter, bindAction } from 'angular2/src/test_lib/benchmark_util'; -import angular = require("angular"); +declare var angular: any; var totalRows = getIntParameter('rows'); var totalColumns = getIntParameter('columns'); diff --git a/modules/benchmarks_external/src/static_tree/tree_benchmark.ts b/modules/benchmarks_external/src/static_tree/tree_benchmark.ts index 1507208a10..347bf00def 100644 --- a/modules/benchmarks_external/src/static_tree/tree_benchmark.ts +++ b/modules/benchmarks_external/src/static_tree/tree_benchmark.ts @@ -1,6 +1,6 @@ // static tree benchmark in AngularJS 1.x import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util'; -import angular = require("angular"); +declare var angular: any; const MAX_DEPTH = 10; diff --git a/modules/benchmarks_external/src/tree/react/react.min.d.ts b/modules/benchmarks_external/src/tree/react/react.min.d.ts new file mode 100644 index 0000000000..661d8fb945 --- /dev/null +++ b/modules/benchmarks_external/src/tree/react/react.min.d.ts @@ -0,0 +1,2 @@ +declare var React: any; +export default React; diff --git a/modules/benchmarks_external/src/tree/tree_benchmark.ts b/modules/benchmarks_external/src/tree/tree_benchmark.ts index 4ec5df35c6..5d3aed4982 100644 --- a/modules/benchmarks_external/src/tree/tree_benchmark.ts +++ b/modules/benchmarks_external/src/tree/tree_benchmark.ts @@ -1,6 +1,6 @@ // tree benchmark in AngularJS 1.x import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util'; -import angular = require("angular"); +declare var angular: any; export function main() { angular.bootstrap(document.querySelector('tree'), ['app']); diff --git a/modules/benchpress/index.ts b/modules/benchpress/index.ts index ed8530f3fc..32a97be9b6 100644 --- a/modules/benchpress/index.ts +++ b/modules/benchpress/index.ts @@ -3,4 +3,4 @@ require('traceur/bin/traceur-runtime'); module.exports = require('./benchpress.js'); // when bundling benchpress to one file, this is used // for getting exports out of browserify's scope. -global.__benchpressExports = module.exports; +(global).__benchpressExports = module.exports; diff --git a/modules/benchpress/src/webdriver/selenium_webdriver_adapter.ts b/modules/benchpress/src/webdriver/selenium_webdriver_adapter.ts index 3c66e1ed5c..74803879ab 100644 --- a/modules/benchpress/src/webdriver/selenium_webdriver_adapter.ts +++ b/modules/benchpress/src/webdriver/selenium_webdriver_adapter.ts @@ -2,7 +2,7 @@ import {Promise, PromiseWrapper} from 'angular2/src/facade/async'; import {bind, Binding} from 'angular2/di'; import {WebDriverAdapter} from '../web_driver_adapter'; -import webdriver = require('selenium-webdriver'); +import * as webdriver from 'selenium-webdriver'; /** * Adapter for the selenium-webdriver. @@ -56,5 +56,7 @@ function convertToLocalProcess(data): Object { return JSON.parse(serialized); } -var _PROTRACTOR_BINDINGS = - [bind(WebDriverAdapter).toFactory(() => new SeleniumWebDriverAdapter(global.browser), [])]; +var _PROTRACTOR_BINDINGS = [ + bind(WebDriverAdapter) + .toFactory(() => new SeleniumWebDriverAdapter((global).browser), []) +]; diff --git a/modules/examples/src/http/http_comp.ts b/modules/examples/src/http/http_comp.ts index 4485440798..55ef0b05e9 100644 --- a/modules/examples/src/http/http_comp.ts +++ b/modules/examples/src/http/http_comp.ts @@ -1,5 +1,5 @@ import {Component, View, NgFor} from 'angular2/angular2'; -import {Http} from 'angular2/http'; +import {Http, Response} from 'angular2/http'; import {ObservableWrapper} from 'angular2/src/facade/async'; @Component({selector: 'http-app'}) @@ -17,6 +17,7 @@ import {ObservableWrapper} from 'angular2/src/facade/async'; export class HttpCmp { people: Object; constructor(http: Http) { - ObservableWrapper.subscribe(http.get('./people.json'), res => this.people = res.json()); + ObservableWrapper.subscribe(http.get('./people.json'), + res => this.people = res.json()); } } diff --git a/modules/examples/src/http/index.ts b/modules/examples/src/http/index.ts index fa6758a86d..eb2f6f946b 100644 --- a/modules/examples/src/http/index.ts +++ b/modules/examples/src/http/index.ts @@ -1,4 +1,4 @@ -/// +/// import {bootstrap} from 'angular2/bootstrap'; import {httpInjectables} from 'angular2/http'; diff --git a/modules/examples/src/jsonp/index.ts b/modules/examples/src/jsonp/index.ts index b57cd3d517..51fa9a23fc 100644 --- a/modules/examples/src/jsonp/index.ts +++ b/modules/examples/src/jsonp/index.ts @@ -1,4 +1,4 @@ -/// +/// import {bootstrap} from 'angular2/bootstrap'; import {jsonpInjectables} from 'angular2/http'; diff --git a/modules/examples/src/jsonp/jsonp_comp.ts b/modules/examples/src/jsonp/jsonp_comp.ts index 1ed80aaf41..6ac3a4b2c9 100644 --- a/modules/examples/src/jsonp/jsonp_comp.ts +++ b/modules/examples/src/jsonp/jsonp_comp.ts @@ -1,5 +1,5 @@ import {Component, View, NgFor} from 'angular2/angular2'; -import {Jsonp} from 'angular2/http'; +import {Jsonp, Response} from 'angular2/http'; import {ObservableWrapper} from 'angular2/src/facade/async'; @Component({selector: 'jsonp-app'}) @@ -17,7 +17,7 @@ import {ObservableWrapper} from 'angular2/src/facade/async'; export class JsonpCmp { people: Object; constructor(jsonp: Jsonp) { - ObservableWrapper.subscribe(jsonp.get('./people.json?callback=JSONP_CALLBACK'), - res => this.people = res.json()); + ObservableWrapper.subscribe(jsonp.get('./people.json?callback=JSONP_CALLBACK'), + res => this.people = res.json()); } } diff --git a/modules/examples/src/model_driven_forms/index.ts b/modules/examples/src/model_driven_forms/index.ts index 0da45578c8..cbd60c36c2 100644 --- a/modules/examples/src/model_driven_forms/index.ts +++ b/modules/examples/src/model_driven_forms/index.ts @@ -1,13 +1,4 @@ -import { - bootstrap, - onChange, - NgIf, - NgFor, - Component, - Directive, - View, - Host -} from 'angular2/bootstrap'; +import {bootstrap, NgIf, NgFor, Component, Directive, View, Host} from 'angular2/bootstrap'; import {formDirectives, NgControl, Validators, NgFormModel, FormBuilder} from 'angular2/forms'; import {RegExpWrapper, print, isPresent} from 'angular2/src/facade/lang'; diff --git a/modules/examples/src/order_management/index.ts b/modules/examples/src/order_management/index.ts index cdb7167256..5145cc3095 100644 --- a/modules/examples/src/order_management/index.ts +++ b/modules/examples/src/order_management/index.ts @@ -1,6 +1,5 @@ import { bootstrap, - onChange, NgIf, NgFor, Component, diff --git a/modules/examples/src/person_management/index.ts b/modules/examples/src/person_management/index.ts index f55c47f86a..b85a9474ac 100644 --- a/modules/examples/src/person_management/index.ts +++ b/modules/examples/src/person_management/index.ts @@ -1,6 +1,5 @@ import { bootstrap, - onChange, NgIf, NgFor, Component, diff --git a/modules/examples/src/routing/inbox-app.ts b/modules/examples/src/routing/inbox-app.ts index 8e0751f550..b3ac28cde0 100644 --- a/modules/examples/src/routing/inbox-app.ts +++ b/modules/examples/src/routing/inbox-app.ts @@ -8,7 +8,7 @@ import { Location, RouteParams } from 'angular2/router'; -import {Http} from 'angular2/http'; +import {Http, Response} from 'angular2/http'; import {ObservableWrapper, PromiseWrapper} from 'angular2/src/facade/async'; import {ListWrapper} from 'angular2/src/facade/collection'; import {isPresent} from 'angular2/src/facade/lang'; @@ -63,7 +63,8 @@ class DbService { getData() { var p = PromiseWrapper.completer(); - ObservableWrapper.subscribe(this.http.get('./db.json'), (resp) => { p.resolve(resp.json()); }); + ObservableWrapper.subscribe(this.http.get('./db.json'), + (resp) => { p.resolve(resp.json()); }); return p.promise; } diff --git a/modules/examples/src/template_driven_forms/index.ts b/modules/examples/src/template_driven_forms/index.ts index a8b71dc3c7..f174f0ad01 100644 --- a/modules/examples/src/template_driven_forms/index.ts +++ b/modules/examples/src/template_driven_forms/index.ts @@ -1,6 +1,5 @@ import { bootstrap, - onChange, NgIf, NgFor, Component, diff --git a/modules/examples/src/todo/index.ts b/modules/examples/src/todo/index.ts index 6c934eda61..f2347e3e7b 100644 --- a/modules/examples/src/todo/index.ts +++ b/modules/examples/src/todo/index.ts @@ -38,7 +38,7 @@ class TodoApp { this.todoStore.list.forEach((todo: Todo) => { todo.completed = isComplete; }); } - clearCompleted(): void { this.todoStore.removeBy((todo) => todo.completed); } + clearCompleted(): void { this.todoStore.removeBy((todo: Todo) => todo.completed); } } export function main() { diff --git a/modules/examples/src/todo/services/TodoStore.ts b/modules/examples/src/todo/services/TodoStore.ts index 9797549661..6d9721d496 100644 --- a/modules/examples/src/todo/services/TodoStore.ts +++ b/modules/examples/src/todo/services/TodoStore.ts @@ -1,5 +1,5 @@ import {Injectable} from 'angular2/angular2'; -import {ListWrapper} from 'angular2/src/facade/collection'; +import {ListWrapper, Predicate} from 'angular2/src/facade/collection'; // base model for RecordStore export class KeyModel { @@ -30,7 +30,7 @@ export class Store { remove(record: KeyModel): void { this._spliceOut(record); } - removeBy(callback: Function): void { + removeBy(callback: Predicate): void { var records = ListWrapper.filter(this.list, callback); ListWrapper.removeAll(this.list, records); } diff --git a/modules/examples/src/web_workers/todo/index_common.ts b/modules/examples/src/web_workers/todo/index_common.ts index 7ae55dd299..4f515f407c 100644 --- a/modules/examples/src/web_workers/todo/index_common.ts +++ b/modules/examples/src/web_workers/todo/index_common.ts @@ -56,5 +56,5 @@ export class TodoApp { this.todoStore.list.forEach((todo: Todo) => { todo.completed = this.isComplete; }); } - clearCompleted(): void { this.todoStore.removeBy((todo) => todo.completed); } + clearCompleted(): void { this.todoStore.removeBy((todo: Todo) => todo.completed); } } diff --git a/modules/examples/src/web_workers/todo/services/TodoStore.ts b/modules/examples/src/web_workers/todo/services/TodoStore.ts index 11b8b566e1..7060f1302f 100644 --- a/modules/examples/src/web_workers/todo/services/TodoStore.ts +++ b/modules/examples/src/web_workers/todo/services/TodoStore.ts @@ -1,5 +1,5 @@ import {Injectable} from 'angular2/angular2'; -import {ListWrapper} from 'angular2/src/facade/collection'; +import {ListWrapper, Predicate} from 'angular2/src/facade/collection'; // base model for RecordStore export class KeyModel { @@ -34,7 +34,7 @@ export class Store { remove(record: KeyModel): void { this._spliceOut(record); } - removeBy(callback: Function): void { + removeBy(callback: Predicate): void { var records = ListWrapper.filter(this.list, callback); ListWrapper.removeAll(this.list, records); } diff --git a/npm-shrinkwrap.clean.json b/npm-shrinkwrap.clean.json index 3b631c7da8..a53eb3dc87 100644 --- a/npm-shrinkwrap.clean.json +++ b/npm-shrinkwrap.clean.json @@ -10213,10 +10213,6 @@ } } } - }, - "typescript": { - "version": "1.5.3", - "resolved": "git://github.com/microsoft/TypeScript.git#a24aa6f57d281bafd3535f0f4c3f492364a8b4d6" } } }, @@ -10789,7 +10785,7 @@ }, "typescript": { "version": "1.5.3", - "resolved": "git://github.com/alexeagle/TypeScript.git#076bca017732cc9c44000ca0866199be64e21810" + "resolved": "git://github.com/alexeagle/TypeScript.git#90373cd85a87bd5d6d20dac58ba0df046da01b1d" }, "vinyl": { "version": "0.4.6", diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 4cafb85f9a..f3f7cdbd79 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -15753,42 +15753,38 @@ "ts2dart": { "version": "0.7.1", "from": "ts2dart@0.7.1", + "resolved": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.1.tgz", "dependencies": { "source-map": { "version": "0.4.4", - "from": "source-map@>=0.4.2 <0.5.0", + "from": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "dependencies": { "amdefine": { "version": "1.0.0", - "from": "amdefine@>=0.0.4", + "from": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz" } } }, "source-map-support": { "version": "0.3.2", - "from": "source-map-support@>=0.3.1 <0.4.0", + "from": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.3.2.tgz", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.3.2.tgz", "dependencies": { "source-map": { "version": "0.1.32", - "from": "source-map@0.1.32", + "from": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz", "dependencies": { "amdefine": { "version": "1.0.0", - "from": "amdefine@>=0.0.4", + "from": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz" } } } } - }, - "typescript": { - "version": "1.5.3", - "from": "microsoft/TypeScript#release-1.5", - "resolved": "git://github.com/microsoft/TypeScript.git#a24aa6f57d281bafd3535f0f4c3f492364a8b4d6" } } }, @@ -16679,8 +16675,8 @@ }, "typescript": { "version": "1.5.3", - "from": "git://github.com/alexeagle/TypeScript.git#076bca017732cc9c44000ca0866199be64e21810", - "resolved": "git://github.com/alexeagle/TypeScript.git#076bca017732cc9c44000ca0866199be64e21810" + "from": "alexeagle/TypeScript#1.5_error_is_class", + "resolved": "git://github.com/alexeagle/TypeScript.git#90373cd85a87bd5d6d20dac58ba0df046da01b1d" }, "vinyl": { "version": "0.4.6", diff --git a/tools/broccoli/trees/browser_tree.ts b/tools/broccoli/trees/browser_tree.ts index 6681dea4e2..938f79d036 100644 --- a/tools/broccoli/trees/browser_tree.ts +++ b/tools/broccoli/trees/browser_tree.ts @@ -70,9 +70,17 @@ const kServedPaths = [ module.exports = function makeBrowserTree(options, destinationPath) { - var modulesTree = new Funnel( - 'modules', - {include: ['**/**'], exclude: ['**/*.cjs', 'benchmarks/e2e_test/**'], destDir: '/'}); + var modulesTree = new Funnel('modules', { + include: ['**/**'], + exclude: [ + '**/*.cjs', + 'benchmarks/e2e_test/**', + // Exclude ES6 polyfill typings when tsc target=ES6 + 'angular2/traceur-runtime.d.ts', + 'angular2/typings/es6-promise/**' + ], + destDir: '/' + }); var scriptPathPatternReplacement = { match: '@@FILENAME_NO_EXT', @@ -87,21 +95,19 @@ module.exports = function makeBrowserTree(options, destinationPath) { }); // Use TypeScript to transpile the *.ts files to ES6 - // We don't care about errors: we let the TypeScript compilation to ES5 - // in node_tree.ts do the type-checking. var es6Tree = compileWithTypescript(modulesTree, { allowNonTsExtensions: false, declaration: true, emitDecoratorMetadata: true, - mapRoot: '', // force sourcemaps to use relative path - noEmitOnError: false, // temporarily ignore errors, we type-check only via cjs build + mapRoot: '', // force sourcemaps to use relative path + noEmitOnError: true, rootDir: '.', sourceMap: true, sourceRoot: '.', target: 'ES6' }); - // Call Traceur again to lower the ES6 build tree to ES5 + // Call Traceur to lower the ES6 build tree to ES5 var es5Tree = transpileWithTraceur(es6Tree, { destExtension: '.js', destSourceMapExtension: '.js.map',