chore(build): Upgrade to TypeScript@1.5.3

This change also makes us compliant with 1.6.0-dev compiler,
so we can do some experiments with apps that use 1.6 features
and compile against Angular.

We should probably add a travis build for 1.6 so we stay compatible
with both versions.
This commit is contained in:
Alex Eagle
2015-07-29 20:09:54 -07:00
parent c5cb7009ca
commit 3c58878b19
28 changed files with 140 additions and 145 deletions

View File

@ -27,12 +27,7 @@ export {
} from 'angular2/src/core/compiler/interfaces';
export {
Class,
ClassDefinition,
ParameterDecorator,
TypeDecorator
} from 'angular2/src/util/decorators';
export {Class, ClassDefinition, TypeDecorator} from 'angular2/src/util/decorators';
export {
Attribute,

View File

@ -1,13 +1,7 @@
import {ComponentAnnotation, DirectiveAnnotation, LifecycleEvent} from './annotations';
import {ViewAnnotation} from './view';
import {AttributeAnnotation, QueryAnnotation, ViewQueryAnnotation} from './di';
import {
makeDecorator,
makeParamDecorator,
TypeDecorator,
ParameterDecorator,
Class
} from '../../util/decorators';
import {makeDecorator, makeParamDecorator, TypeDecorator, Class} from '../../util/decorators';
import {Type} from 'angular2/src/facade/lang';
import {ViewEncapsulation} from 'angular2/src/render/api';

View File

@ -8,6 +8,9 @@ declare module Intl {
currency?: string;
currencyDisplay?: string;
useGrouping?: boolean;
minimumIntegerDigits?: number;
minimumFractionDigits?: number;
maximumFractionDigits?: number;
}
interface NumberFormat {

View File

@ -59,18 +59,18 @@ export function CONST_EXPR<T>(expr: T): T {
return expr;
}
export function CONST():<T>(target: T) => T {
export function CONST(): ClassDecorator {
return (target) => target;
}
export function ABSTRACT():<T>(target: T) => T {
export function ABSTRACT(): ClassDecorator {
return (t) => t;
}
// Note: This is only a marker annotation needed for ts2dart.
// This is written so that is can be used as a Traceur annotation
// or a Typescript decorator.
export function IMPLEMENTS(_):<T>(target: T) => T {
export function IMPLEMENTS(_): ClassDecorator {
return (t) => t;
}

View File

@ -6,7 +6,7 @@ import {List, ListWrapper} from 'angular2/src/facade/collection';
import {Location} from 'angular2/src/router/location';
@proxy
@proxy()
@IMPLEMENTS(Location)
export class SpyLocation extends SpyObject {
urlChanges: List<string>;

View File

@ -22,10 +22,15 @@ export class Route implements RouteDefinition {
path: string;
component: Type;
as: string;
// added next two properties to work around https://github.com/Microsoft/TypeScript/issues/4107
loader: Function;
redirectTo: string;
constructor({path, component, as}: {path: string, component: Type, as?: string}) {
this.path = path;
this.component = component;
this.as = as;
this.loader = null;
this.redirectTo = null;
}
}

View File

@ -4,32 +4,32 @@ import 'package:angular2/src/change_detection/change_detection.dart';
import 'package:angular2/di.dart';
import './test_lib.dart';
@proxy
@proxy()
class SpyChangeDetector extends SpyObject implements ChangeDetector {
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy
@proxy()
class SpyProtoChangeDetector extends SpyObject implements ProtoChangeDetector {
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy
@proxy()
class SpyPipe extends SpyObject implements Pipe {
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy
@proxy()
class SpyPipeFactory extends SpyObject implements PipeFactory {
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy
@proxy()
class SpyDependencyProvider extends SpyObject implements DependencyProvider {
noSuchMethod(m) => super.noSuchMethod(m);
}
@proxy
@proxy()
class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef {
noSuchMethod(m) => super.noSuchMethod(m);
}

View File

@ -12,7 +12,9 @@ import {createTestInjector, FunctionWithParamTokens, inject} from './test_inject
export {inject} from './test_injector';
export function proxy() {}
export function proxy(): ClassDecorator {
return (t) => t;
}
var _global: jasmine.GlobalPolluter = <any>(typeof window === 'undefined' ? global : window);

View File

@ -49,6 +49,12 @@ export interface TypeDecorator {
*/
<T extends Type>(type: T): T;
// Make TypeDecorator assignable to built-in ParameterDecorator type.
// ParameterDecorator is declared in lib.d.ts as a `declare type`
// so we cannot declare this interface as a subtype.
// see https://github.com/angular/angular/issues/3379#issuecomment-126169417
(target: Object, propertyKey: string | symbol, parameterIndex: number): void;
/**
* Storage for the accumulated annotations so far used by the DSL syntax.
*
@ -62,17 +68,6 @@ export interface TypeDecorator {
Class(obj: ClassDefinition): Type;
}
/**
* An interface implemented by all Angular parameter decorators, which allows them to be used as ES7
* decorators.
*/
export interface ParameterDecorator {
/**
* Invoke as ES7 decorator.
*/
(cls: Type, unusedKey: any, index: number): void;
}
function extractAnnotation(annotation: any): any {
if (isFunction(annotation) && annotation.hasOwnProperty('annotation')) {
// it is a decorator, extract annotation

View File

@ -117,7 +117,7 @@ export function main() {
});
}
@proxy
@proxy()
@IMPLEMENTS(ChangeDetectorRef)
class SpyChangeDetectorRef extends SpyObject {
constructor() { super(ChangeDetectorRef); }

View File

@ -119,7 +119,7 @@ export function main() {
});
}
@proxy
@proxy()
@IMPLEMENTS(ChangeDetectorRef)
class SpyChangeDetectorRef extends SpyObject {
constructor() { super(ChangeDetectorRef); }

View File

@ -658,14 +658,14 @@ class DirectiveWithAttributes {
constructor(@Attribute('someAttr') someAttr: String) {}
}
@proxy
@proxy()
@IMPLEMENTS(RenderCompiler)
class SpyRenderCompiler extends SpyObject {
constructor() { super(RenderCompiler); }
noSuchMethod(m) { return super.noSuchMethod(m) }
}
@proxy
@proxy()
@IMPLEMENTS(DirectiveResolver)
class SpyDirectiveResolver extends SpyObject {
constructor() { super(DirectiveResolver); }
@ -719,4 +719,4 @@ function collectEmbeddedPvs(pv: AppProtoView, target: AppProtoView[] = null): Ap
}
});
return target;
}
}

View File

@ -48,7 +48,7 @@ import {ElementRef} from 'angular2/src/core/compiler/element_ref';
import {DynamicChangeDetector, ChangeDetectorRef, Parser, Lexer} from 'angular2/src/change_detection/change_detection';
import {QueryList} from 'angular2/src/core/compiler/query_list';
@proxy
@proxy()
@IMPLEMENTS(AppView)
class DummyView extends SpyObject {
changeDetector;
@ -59,7 +59,7 @@ class DummyView extends SpyObject {
noSuchMethod(m) { return super.noSuchMethod(m); }
}
@proxy
@proxy()
@IMPLEMENTS(ElementRef)
class DummyElementRef extends SpyObject {
boundElementIndex: number = 0;

View File

@ -227,7 +227,7 @@ class ThrowingComponent2 {
}
}
@proxy
@proxy()
class PropModel implements Map {
final String foo = 'foo-prop';

View File

@ -199,7 +199,7 @@ function createRenderViewportElementBinder(nestedProtoView) {
return new renderApi.ElementBinder({nestedProtoView: nestedProtoView});
}
@proxy
@proxy()
@IMPLEMENTS(ChangeDetection)
class ChangeDetectionSpy extends SpyObject {
constructor() { super(ChangeDetection); }

View File

@ -62,7 +62,7 @@ export function main() {
});
}
@proxy
@proxy()
@IMPLEMENTS(AppView)
class AppViewSpy extends SpyObject {
viewContainers: AppViewContainer[] = [null];
@ -70,7 +70,7 @@ class AppViewSpy extends SpyObject {
noSuchMethod(m) { return super.noSuchMethod(m) }
}
@proxy
@proxy()
@IMPLEMENTS(AppViewManager)
class AppViewManagerSpy extends SpyObject {
constructor() { super(AppViewManager); }

View File

@ -507,21 +507,21 @@ export function main() {
});
}
@proxy
@proxy()
@IMPLEMENTS(Renderer)
class SpyRenderer extends SpyObject {
constructor() { super(Renderer); }
noSuchMethod(m) { return super.noSuchMethod(m) }
}
@proxy
@proxy()
@IMPLEMENTS(AppViewPool)
class SpyAppViewPool extends SpyObject {
constructor() { super(AppViewPool); }
noSuchMethod(m) { return super.noSuchMethod(m) }
}
@proxy
@proxy()
@IMPLEMENTS(AppViewListener)
class SpyAppViewListener extends SpyObject {
constructor() { super(AppViewListener); }

View File

@ -353,7 +353,7 @@ export function createEmbeddedPv(binders: ElementBinder[] = null) {
class SomeComponent {
}
@proxy
@proxy()
@IMPLEMENTS(ProtoElementInjector)
class SpyProtoElementInjector extends SpyObject {
index: number;
@ -361,21 +361,21 @@ class SpyProtoElementInjector extends SpyObject {
noSuchMethod(m) { return super.noSuchMethod(m) }
}
@proxy
@proxy()
@IMPLEMENTS(ElementInjector)
class SpyElementInjector extends SpyObject {
constructor(public parent: ElementInjector) { super(ElementInjector); }
noSuchMethod(m) { return super.noSuchMethod(m) }
}
@proxy
@proxy()
@IMPLEMENTS(PreBuiltObjects)
class SpyPreBuiltObjects extends SpyObject {
constructor() { super(PreBuiltObjects); }
noSuchMethod(m) { return super.noSuchMethod(m) }
}
@proxy
@proxy()
@IMPLEMENTS(Injector)
class SpyInjector extends SpyObject {
constructor() { super(Injector); }

View File

@ -79,7 +79,7 @@ class TestComponent {
}
@proxy
@proxy()
@IMPLEMENTS(Location)
class DummyLocation extends SpyObject {
noSuchMethod(m) { return super.noSuchMethod(m) }
@ -92,7 +92,7 @@ function makeDummyLocation() {
}
@proxy
@proxy()
@IMPLEMENTS(Router)
class DummyRouter extends SpyObject {
noSuchMethod(m) { return super.noSuchMethod(m) }

View File

@ -161,7 +161,7 @@ export function main() {
});
}
@proxy
@proxy()
@IMPLEMENTS(RouterOutlet)
class DummyOutlet extends SpyObject {
noSuchMethod(m) { return super.noSuchMethod(m) }

View File

@ -58,7 +58,7 @@ export function main() {
});
}
@proxy
@proxy()
@IMPLEMENTS(ElementRef)
class SpyElementRef extends SpyObject {
nativeElement;
@ -66,7 +66,7 @@ class SpyElementRef extends SpyObject {
noSuchMethod(m) { return super.noSuchMethod(m) }
}
@proxy
@proxy()
@IMPLEMENTS(DomAdapter)
class SpyDomAdapter extends SpyObject {
constructor() { super(DomAdapter); }

View File

@ -21,7 +21,7 @@ class TestObj {
someComplexFunc(a) { return a; }
}
@proxy
@proxy()
@IMPLEMENTS(TestObj)
class SpyTestObj extends SpyObject {
constructor() { super(TestObj); }

View File

@ -69,8 +69,8 @@ export function main() {
var i0, i1;
var MyClass =
(<any>TestDecorator('test-works'))
.Class({
extends: Class({
.Class(<any>{
extends: Class(<any>{
constructor: function() {},
extendWorks: function() { return 'extend ' + this.arg; }
}),
@ -121,7 +121,7 @@ export function main() {
});
it('should ensure that only Function|Arrays are supported', () => {
expect(() => { Class({constructor: function() {}, method: 'non_function'}); })
expect(() => { Class(<any>{constructor: function() {}, method: 'non_function'}); })
.toThrowError(
"Only Function or Array is supported in Class definition for key 'method' is 'non_function'");
});