fix(types): parametrize QueryList.

This commit is contained in:
Rado Kirov
2015-06-03 15:39:20 -07:00
parent 20e874d3c6
commit 552985e305
8 changed files with 17 additions and 19 deletions

View File

@ -1,6 +1,5 @@
library angular2.src.core.compiler.base_query_list;
import 'package:angular2/src/core/annotations_impl/annotations.dart';
import 'dart:collection';
/**
@ -10,8 +9,8 @@ import 'dart:collection';
* In the future this class will implement an Observable interface.
* For now it uses a plain list of observable callbacks.
*/
class BaseQueryList extends Object with IterableMixin<Directive> {
List<Directive> _results;
class BaseQueryList<T> extends Object with IterableMixin<T> {
List<T> _results;
List _callbacks;
bool _dirty;
@ -20,7 +19,7 @@ class BaseQueryList extends Object with IterableMixin<Directive> {
_callbacks = [],
_dirty = false;
Iterator<Directive> get iterator => _results.iterator;
Iterator<T> get iterator => _results.iterator;
reset(newList) {
_results = newList;

View File

@ -1,5 +1,4 @@
import {List, MapWrapper, ListWrapper} from 'angular2/src/facade/collection';
import {Directive} from 'angular2/src/core/annotations_impl/annotations';
/**
* Injectable Objects that contains a live list of child directives in the light Dom of a directive.
@ -10,8 +9,8 @@ import {Directive} from 'angular2/src/core/annotations_impl/annotations';
*
* @exportedAs angular2/view
*/
export class BaseQueryList {
_results: List<Directive>;
export class BaseQueryList<T> {
_results: List<T>;
_callbacks;
_dirty;

View File

@ -947,7 +947,7 @@ export class ElementInjector extends TreeNode<ElementInjector> {
}
private _createQueryRef(directive): void {
var queryList = new QueryList();
var queryList = new QueryList<any>();
if (isBlank(this._query0)) {
this._query0 = new QueryRef(directive, queryList, this);
} else if (isBlank(this._query1)) {
@ -1515,10 +1515,10 @@ class QueryError extends BaseException {
class QueryRef {
directive;
list: QueryList;
list: QueryList<any>;
originator: ElementInjector;
constructor(directive, list: QueryList, originator: ElementInjector) {
constructor(directive, list: QueryList<any>, originator: ElementInjector) {
this.directive = directive;
this.list = list;
this.originator = originator;

View File

@ -75,7 +75,7 @@ import {BaseQueryList} from './base_query_list';
*
* @exportedAs angular2/view
*/
export class QueryList extends BaseQueryList {
export class QueryList<T> extends BaseQueryList<T> {
/**
*/
onChange(callback) { return super.onChange(callback); }