refactor: add missing types for ts2dart

Closes #4568
This commit is contained in:
Victor Berchet 2015-10-06 19:05:09 -07:00
parent aaa215514b
commit a0277f1b3a
8 changed files with 32 additions and 23 deletions

View File

@ -136,7 +136,7 @@ export class RenderViewWithFragmentsStore {
}
var viewRef = this.deserializeRenderViewRef(obj['viewRef']);
var fragments = obj['fragmentRefs'].map(val => this.deserializeRenderFragmentRef(val));
var fragments = (<any[]>obj['fragmentRefs']).map(val => this.deserializeRenderFragmentRef(val));
return new RenderViewWithFragments(viewRef, fragments);
}

View File

@ -1,7 +1,6 @@
import {ddescribe, describe, it, xit, iit, expect, beforeEach} from 'angular2/test_lib';
import {isBlank, isPresent} from 'angular2/src/core/facade/lang';
import {reflector} from 'angular2/src/core/reflection/reflection';
import {MapWrapper} from 'angular2/src/core/facade/collection';
import {Parser} from 'angular2/src/core/change_detection/parser/parser';
import {Unparser} from './unparser';
import {Lexer} from 'angular2/src/core/change_detection/parser/lexer';
@ -270,9 +269,11 @@ export function main() {
describe('parseTemplateBindings', () => {
function keys(templateBindings) { return templateBindings.map(binding => binding.key); }
function keys(templateBindings: any[]) {
return templateBindings.map(binding => binding.key);
}
function keyValues(templateBindings) {
function keyValues(templateBindings: any[]) {
return templateBindings.map(binding => {
if (binding.keyIsVar) {
return '#' + binding.key + (isBlank(binding.name) ? '=null' : '=' + binding.name);
@ -282,7 +283,7 @@ export function main() {
});
}
function exprSources(templateBindings) {
function exprSources(templateBindings: any[]) {
return templateBindings.map(
binding => isPresent(binding.expression) ? binding.expression.source : null);
}

View File

@ -85,7 +85,7 @@ export class ConsoleReporter extends Reporter {
return PromiseWrapper.resolve(null);
}
_printStringRow(parts, fill = ' ') {
_printStringRow(parts: any[], fill = ' ') {
this._print(
parts.map(part => ConsoleReporter._lpad(part, this._columnWidth, fill)).join(' | '));
}

View File

@ -1,5 +1,4 @@
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
import {ListWrapper} from 'angular2/src/core/facade/collection';
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
import {MeasureValues} from '../measure_values';

View File

@ -17,7 +17,7 @@ import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
import {Metric, MultiMetric, bind, Injector} from 'benchpress/common';
export function main() {
function createMetric(ids) {
function createMetric(ids: any[]) {
var m = Injector.resolveAndCreate([
ids.map(id => bind(id).toValue(new MockMetric(id))),
MultiMetric.createBindings(ids)

View File

@ -11,14 +11,13 @@ import {
xit,
} from 'angular2/test_lib';
import {ListWrapper} from 'angular2/src/core/facade/collection';
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
import {DateWrapper} from 'angular2/src/core/facade/lang';
import {Reporter, MultiReporter, bind, Injector, MeasureValues} from 'benchpress/common';
export function main() {
function createReporters(ids) {
function createReporters(ids: any[]) {
var r = Injector.resolveAndCreate([
ids.map(id => bind(id).toValue(new MockReporter(id))),
MultiReporter.createBindings(ids)

View File

@ -11,14 +11,13 @@ import {
xit,
} from 'angular2/test_lib';
import {ListWrapper} from 'angular2/src/core/facade/collection';
import {isPresent, StringWrapper} from 'angular2/src/core/facade/lang';
import {PromiseWrapper} from 'angular2/src/core/facade/async';
import {WebDriverExtension, bind, Injector, Options} from 'benchpress/common';
export function main() {
function createExtension(ids, caps) {
function createExtension(ids: any[], caps) {
return PromiseWrapper.wrap(() => {
return Injector.resolveAndCreate([
ids.map(id => bind(id).toValue(new MockExtension(id))),

View File

@ -13,11 +13,6 @@ import {ObservableWrapper, PromiseWrapper, Promise} from 'angular2/src/core/faca
import {ListWrapper} from 'angular2/src/core/facade/collection';
import {isPresent} from 'angular2/src/core/facade/lang';
interface RecordData {
id: string, subject: string, content: string, email: string, firstName: string, lastName: string,
date: string, draft?: boolean
}
class InboxRecord {
id: string = '';
subject: string = '';
@ -28,13 +23,29 @@ class InboxRecord {
date: string = '';
draft: boolean = false;
constructor(data: RecordData = null) {
constructor(data: {
id: string,
subject: string,
content: string,
email: string,
firstName: string,
lastName: string,
date: string, draft?: boolean
} = null) {
if (isPresent(data)) {
this.setData(data);
}
}
setData(record: RecordData) {
setData(record: {
id: string,
subject: string,
content: string,
email: string,
firstName: string,
lastName: string,
date: string, draft?: boolean
}) {
this.id = record['id'];
this.subject = record['subject'];
this.content = record['content'];
@ -48,26 +59,26 @@ class InboxRecord {
@Injectable()
class DbService {
getData(): Promise<RecordData[]> {
getData(): Promise<any[]> {
var p = PromiseWrapper.completer();
p.resolve(db.data);
return p.promise;
}
drafts(): Promise<RecordData[]> {
drafts(): Promise<any[]> {
return PromiseWrapper.then(this.getData(), (data) => {
return ListWrapper.filter(data,
(record => isPresent(record['draft']) && record['draft'] == true));
});
}
emails(): Promise<RecordData[]> {
emails(): Promise<any[]> {
return PromiseWrapper.then(this.getData(), (data) => {
return ListWrapper.filter(data, (record => !isPresent(record['draft'])));
});
}
email(id): Promise<RecordData> {
email(id): Promise<any> {
return PromiseWrapper.then(this.getData(), (data) => {
for (var i = 0; i < data.length; i++) {
var entry = data[i];