X Tutup
Skip to content

Commit 6093e28

Browse files
committed
fix(typings): repair broken typechecks
We had the typechecker disabled by accident, and many problems snuck in Fixes #4507 Closes #4508
1 parent ae6f549 commit 6093e28

File tree

19 files changed

+100
-77
lines changed

19 files changed

+100
-77
lines changed

modules/angular2/src/core/facade/lang.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function CONST_EXPR<T>(expr: T): T {
5858
return expr;
5959
}
6060

61-
export function CONST(): ClassDecorator {
61+
export function CONST(): ClassDecorator & PropertyDecorator {
6262
return (target) => target;
6363
}
6464

modules/angular2/src/core/util/decorators.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ export interface ClassDefinition {
1818
*
1919
* See {@link Class} for example of usage.
2020
*/
21-
constructor: (Function | any[]);
21+
constructor: Function | any[];
22+
23+
/**
24+
* Other methods on the class. Note that values should have type 'Function' but TS requires
25+
* all properties to have a narrower type than the index signature.
26+
*/
27+
[x: string]: Type | Function | any[];
2228
}
2329

2430
/**

modules/angular2/test/core/forms/directives_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function main() {
9393
});
9494

9595
it("should throw when more than one custom accessor is provided", () => {
96-
var customAccessor = new SpyValueAccessor();
96+
var customAccessor: ControlValueAccessor = <any>new SpyValueAccessor();
9797
expect(() => selectValueAccessor(dir, [customAccessor, customAccessor])).toThrowError();
9898
});
9999
});

modules/angular2/test/core/forms/model_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export function main() {
156156
{"one": new Control("111"), "nested": new ControlGroup({"two": new Control("222")})});
157157
expect(g.value).toEqual({"one": "111", "nested": {"two": "222"}});
158158

159-
g.controls["nested"].controls["two"].updateValue("333");
159+
(<Control>(g.controls["nested"].find("two"))).updateValue("333");
160160

161161
expect(g.value).toEqual({"one": "111", "nested": {"two": "333"}});
162162
});

modules/angular2/test/core/zone/ng_zone_spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ import {
1111
xit,
1212
Log,
1313
isInInnerZone,
14-
browserDetection,
15-
TIMEOUT_INTERVAL_FOR_SLOW_BROWSERS
14+
browserDetection
1615
} from 'angular2/test_lib';
1716

1817
import {PromiseCompleter, PromiseWrapper, TimerWrapper} from 'angular2/src/core/facade/async';

modules/angular2_material/src/components/button/button.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import {Component, View, LifecycleEvent, ViewEncapsulation, OnChanges} from 'angular2/angular2';
1+
import {Component, View, ViewEncapsulation, OnChanges} from 'angular2/angular2';
22

33
import {TimerWrapper} from 'angular2/src/core/facade/async';
44
import {isPresent} from 'angular2/src/core/facade/lang';
55

66

77
// TODO(jelbourn): Ink ripples.
8-
// TODO(jelbourn): Make the `isMosueDown` stuff done with one global listener.
8+
// TODO(jelbourn): Make the `isMouseDown` stuff done with one global listener.
99

1010
@Component({
1111
selector: '[md-button]:not(a), [md-fab]:not(a), [md-raised-button]:not(a)',

modules/angular2_material/src/components/input/input.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
Directive,
3-
LifecycleEvent,
4-
Attribute,
5-
Host,
6-
SkipSelf,
7-
AfterContentChecked
8-
} from 'angular2/angular2';
1+
import {Directive, Attribute, Host, SkipSelf, AfterContentChecked} from 'angular2/angular2';
92

103
import {ObservableWrapper, EventEmitter} from 'angular2/src/core/facade/async';
114

modules/angular2_material/src/components/progress-linear/progress_linear.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
Component,
3-
LifecycleEvent,
4-
View,
5-
ViewEncapsulation,
6-
Attribute,
7-
OnChanges
8-
} from 'angular2/angular2';
1+
import {Component, View, ViewEncapsulation, Attribute, OnChanges} from 'angular2/angular2';
92
import {CONST} from 'angular2/src/core/facade/lang';
103
import {isPresent, isBlank} from 'angular2/src/core/facade/lang';
114
import {Math} from 'angular2/src/core/facade/math';

modules/angular2_material/src/components/radio/radio_button.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
Component,
33
View,
44
ViewEncapsulation,
5-
LifecycleEvent,
65
Host,
76
SkipSelf,
87
Attribute,

modules/benchmarks/src/compiler/compiler_benchmark.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,11 @@ function measureWrapper(func, desc) {
6464

6565
class MultiplyViewResolver extends ViewResolver {
6666
_multiplyBy: number;
67-
_cache: Map<Type, ViewMetadata>;
67+
_cache = new Map<Type, ViewMetadata>();
6868

6969
constructor(multiple: number, components: Type[]) {
7070
super();
7171
this._multiplyBy = multiple;
72-
this._cache = new Map();
7372
ListWrapper.forEach(components, (c) => this._fillCache(c));
7473
}
7574

0 commit comments

Comments
 (0)
X Tutup