X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/angular2/src/core/directives/ng_class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ export class NgClass implements DoCheck, OnDestroy {
this._initialClasses.forEach(className => this._toggleClass(className, !isCleanup));
}

private _applyClasses(rawClassVal, isCleanup: boolean) {
private _applyClasses(rawClassVal: string[] | {[key: string]: string}, isCleanup: boolean) {
if (isPresent(rawClassVal)) {
if (isListLikeIterable(rawClassVal)) {
(<string[]>rawClassVal).forEach(className => this._toggleClass(className, !isCleanup));
} else {
StringMapWrapper.forEach(rawClassVal, (expVal, className) => {
StringMapWrapper.forEach(<{[k: string]: string}>rawClassVal, (expVal, className) => {
if (expVal) this._toggleClass(className, !isCleanup);
});
}
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/core/facade/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class ListWrapper {
static createFixedSize(size: number): any[] { return new Array(size); }
static createGrowableSize(size: number): any[] { return new Array(size); }
static clone<T>(array: T[]): T[] { return array.slice(0); }
static forEachWithIndex<T>(array: T[], fn: (T, number) => void) {
static forEachWithIndex<T>(array: T[], fn: (t: T, n: number) => void) {
for (var i = 0; i < array.length; i++) {
fn(array[i], i);
}
Expand Down
6 changes: 4 additions & 2 deletions modules/angular2/src/core/linker/element_injector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,15 @@ function _createProtoQueryRefs(bindings: BindingWithVisibility[]): ProtoQueryRef
var res = [];
ListWrapper.forEachWithIndex(bindings, (b, i) => {
if (b.binding instanceof DirectiveBinding) {
var directiveBinding = <DirectiveBinding>b.binding;
// field queries
var queries: QueryMetadataWithSetter[] = b.binding.queries;
var queries: QueryMetadataWithSetter[] = directiveBinding.queries;
queries.forEach(q => res.push(new ProtoQueryRef(i, q.setter, q.metadata)));

// queries passed into the constructor.
// TODO: remove this after constructor queries are no longer supported
var deps: DirectiveDependency[] = b.binding.resolvedFactories[0].dependencies;
var deps: DirectiveDependency[] =
<DirectiveDependency[]>directiveBinding.resolvedFactory.dependencies;
deps.forEach(d => {
if (isPresent(d.queryDecorator)) res.push(new ProtoQueryRef(i, null, d.queryDecorator));
});
Expand Down
2 changes: 1 addition & 1 deletion modules/benchpress/src/metric/multi_metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class MultiMetric extends Metric {
}
}

function mergeStringMaps(maps: any[]): Object {
function mergeStringMaps(maps: { [key: string]: string }[]): Object {
var result = {};
maps.forEach(
map => { StringMapWrapper.forEach(map, (value, prop) => { result[prop] = value; }); });
Expand Down
2 changes: 1 addition & 1 deletion modules/benchpress/src/metric/perflog_metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class PerflogMetric extends Metric {
});
}

_addEvents(events: any[]) {
_addEvents(events: { [key: string]: string }[]) {
var needSort = false;
events.forEach(event => {
if (StringWrapper.equals(event['ph'], 'X')) {
Expand Down
4 changes: 2 additions & 2 deletions modules/benchpress/src/statistic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ export class Statistic {
return Statistic.calculateStandardDeviation(sample, mean) / mean * 100;
}

static calculateMean(samples: any[]) {
static calculateMean(samples: number[]) {
var total = 0;
// TODO: use reduce
samples.forEach(x => total += x);
return total / samples.length;
}

static calculateStandardDeviation(samples: any[], mean) {
static calculateStandardDeviation(samples: number[], mean) {
var deviation = 0;
// TODO: use reduce
samples.forEach(x => deviation += Math.pow(x - mean, 2));
Expand Down
X Tutup