Skip to content

Commit c178ad4

Browse files
committed
fix(typings): fix typings which were previously unchecked
Closes #4625
1 parent 597f79e commit c178ad4

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

modules/angular2/src/core/directives/ng_class.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ export class NgClass implements DoCheck, OnDestroy {
108108
this._initialClasses.forEach(className => this._toggleClass(className, !isCleanup));
109109
}
110110

111-
private _applyClasses(rawClassVal, isCleanup: boolean) {
111+
private _applyClasses(rawClassVal: string[] | {[key: string]: string}, isCleanup: boolean) {
112112
if (isPresent(rawClassVal)) {
113113
if (isListLikeIterable(rawClassVal)) {
114114
(<string[]>rawClassVal).forEach(className => this._toggleClass(className, !isCleanup));
115115
} else {
116-
StringMapWrapper.forEach(rawClassVal, (expVal, className) => {
116+
StringMapWrapper.forEach(<{[k: string]: string}>rawClassVal, (expVal, className) => {
117117
if (expVal) this._toggleClass(className, !isCleanup);
118118
});
119119
}

modules/angular2/src/core/linker/element_injector.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,15 @@ function _createProtoQueryRefs(bindings: BindingWithVisibility[]): ProtoQueryRef
212212
var res = [];
213213
ListWrapper.forEachWithIndex(bindings, (b, i) => {
214214
if (b.binding instanceof DirectiveBinding) {
215+
var directiveBinding = <DirectiveBinding>b.binding;
215216
// field queries
216-
var queries: QueryMetadataWithSetter[] = b.binding.queries;
217+
var queries: QueryMetadataWithSetter[] = directiveBinding.queries;
217218
queries.forEach(q => res.push(new ProtoQueryRef(i, q.setter, q.metadata)));
218219

219220
// queries passed into the constructor.
220221
// TODO: remove this after constructor queries are no longer supported
221-
var deps: DirectiveDependency[] = b.binding.resolvedFactories[0].dependencies;
222+
var deps: DirectiveDependency[] =
223+
<DirectiveDependency[]>directiveBinding.resolvedFactory.dependencies;
222224
deps.forEach(d => {
223225
if (isPresent(d.queryDecorator)) res.push(new ProtoQueryRef(i, null, d.queryDecorator));
224226
});

modules/benchpress/src/metric/multi_metric.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class MultiMetric extends Metric {
4242
}
4343
}
4444

45-
function mergeStringMaps(maps: any[]): Object {
45+
function mergeStringMaps(maps: { [key: string]: string }[]): Object {
4646
var result = {};
4747
maps.forEach(
4848
map => { StringMapWrapper.forEach(map, (value, prop) => { result[prop] = value; }); });

modules/benchpress/src/metric/perflog_metric.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export class PerflogMetric extends Metric {
142142
});
143143
}
144144

145-
_addEvents(events: any[]) {
145+
_addEvents(events: { [key: string]: string }[]) {
146146
var needSort = false;
147147
events.forEach(event => {
148148
if (StringWrapper.equals(event['ph'], 'X')) {

modules/benchpress/src/statistic.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ export class Statistic {
55
return Statistic.calculateStandardDeviation(sample, mean) / mean * 100;
66
}
77

8-
static calculateMean(samples: any[]) {
8+
static calculateMean(samples: number[]) {
99
var total = 0;
1010
// TODO: use reduce
1111
samples.forEach(x => total += x);
1212
return total / samples.length;
1313
}
1414

15-
static calculateStandardDeviation(samples: any[], mean) {
15+
static calculateStandardDeviation(samples: number[], mean) {
1616
var deviation = 0;
1717
// TODO: use reduce
1818
samples.forEach(x => deviation += Math.pow(x - mean, 2));

0 commit comments

Comments
 (0)