fix(types): Add StringMap type

This commit is contained in:
Tobias Bosch
2015-02-18 09:04:02 -08:00
parent 56f4e84d45
commit cd90038950
13 changed files with 31 additions and 27 deletions

View File

@ -1,6 +1,6 @@
import {isBlank, isPresent, BaseException, stringify} from 'angular2/src/facade/lang';
import {DOM, Element} from 'angular2/src/facade/dom';
import {StringMapWrapper} from 'angular2/src/facade/collection';
import {StringMapWrapper, StringMap} from 'angular2/src/facade/collection';
import {XHR} from './xhr/xhr';
@ -11,7 +11,7 @@ import {Template} from 'angular2/src/core/annotations/template';
*/
export class TemplateLoader {
_xhr: XHR;
_cache;
_cache: StringMap;
constructor(xhr: XHR) {
this._xhr = xhr;

View File

@ -57,7 +57,6 @@ class MapWrapper {
static Iterable values(Map m) => m.values;
}
// TODO: how to export StringMap=Map as a type?
class StringMapWrapper {
static HashMap create() => new HashMap();
static bool contains(Map map, key) => map.containsKey(key);

View File

@ -3,6 +3,7 @@ import {int, isJsObject, global} from 'angular2/src/facade/lang';
export var List = global.Array;
export var Map = global.Map;
export var Set = global.Set;
export var StringMap = global.Object;
export class MapWrapper {
static create():Map { return new Map(); }
@ -29,7 +30,6 @@ export class MapWrapper {
static values(m) { return m.values(); }
}
// TODO: cannot export StringMap as a type as Dart does not support renaming types...
/**
* Wraps Javascript Objects
*/

View File

@ -1,4 +1,4 @@
import {StringMapWrapper} from 'angular2/src/facade/collection';
import {StringMapWrapper, StringMap} from 'angular2/src/facade/collection';
export class Control {
value:any;
@ -9,9 +9,9 @@ export class Control {
}
export class ControlGroup {
controls;
controls: StringMap;
constructor(controls) {
constructor(controls:StringMap) {
this.controls = controls;
}