chore(typings): remove StringMap

This was a poorly typed attempt to mimic TypeScript's index signatures,
which we can use instead.
This eliminates a very strange type that we were exposing to users, but
not re-exporting through our public API.

Fixes #4483
This commit is contained in:
Alex Eagle
2015-10-02 16:47:54 -07:00
committed by Alex Eagle
parent 2ebc74ddcc
commit 7c4199cd1c
76 changed files with 231 additions and 291 deletions

View File

@ -176,7 +176,7 @@ class _ExpressionWithLocals {
* Map from test id to _ExpressionWithLocals.
* Tests in this map define an expression and local values which those expressions refer to.
*/
static availableDefinitions: StringMap<string, _ExpressionWithLocals> = {
static availableDefinitions: {[key: string]: _ExpressionWithLocals} = {
'valueFromLocals': new _ExpressionWithLocals(
'key', new Locals(null, MapWrapper.createFromPairs([['key', 'value']]))),
'functionFromLocals': new _ExpressionWithLocals(
@ -241,7 +241,7 @@ class _ExpressionWithMode {
* Map from test id to _ExpressionWithMode.
* Definitions in this map define conditions which allow testing various change detector modes.
*/
static availableDefinitions: StringMap<string, _ExpressionWithMode> = {
static availableDefinitions: {[key: string]: _ExpressionWithMode} = {
'emptyUsingDefaultStrategy':
new _ExpressionWithMode(ChangeDetectionStrategy.Default, false, false),
'emptyUsingOnPushStrategy':
@ -316,7 +316,7 @@ class _DirectiveUpdating {
* Definitions in this map define definitions which allow testing directive updating.
*/
static availableDefinitions:
StringMap<string, _DirectiveUpdating> = {
{[key: string]: _DirectiveUpdating} = {
'directNoDispatcher': new _DirectiveUpdating(
[_DirectiveUpdating.updateA('42', _DirectiveUpdating.basicRecords[0])],
[_DirectiveUpdating.basicRecords[0]]),

View File

@ -117,7 +117,7 @@ class DirectiveWithoutModuleId {
class ComponentWithEverything implements OnChanges,
OnInit, DoCheck, OnDestroy, AfterContentInit, AfterContentChecked, AfterViewInit,
AfterViewChecked {
onChanges(changes: StringMap<string, SimpleChange>): void {}
onChanges(changes: {[key: string]: SimpleChange}): void {}
onInit(): void {}
doCheck(): void {}
onDestroy(): void {}

View File

@ -1,10 +1,9 @@
import {ElementSchemaRegistry} from 'angular2/src/core/compiler/schema/element_schema_registry';
import {StringMap} from 'angular2/src/core/facade/collection';
import {isPresent} from 'angular2/src/core/facade/lang';
export class MockSchemaRegistry implements ElementSchemaRegistry {
constructor(public existingProperties: StringMap<string, boolean>,
public attrPropMapping: StringMap<string, string>) {}
constructor(public existingProperties: {[key: string]: boolean},
public attrPropMapping: {[key: string]: string}) {}
hasProperty(tagName: string, property: string): boolean {
var result = this.existingProperties[property];
return isPresent(result) ? result : true;

View File

@ -325,10 +325,10 @@ function testableStylesModule(sourceModule: SourceModule): SourceModule {
// Attention: read by eval!
export function humanizeTemplate(template: CompiledTemplate,
humanizedTemplates: Map<number, StringMap<string, any>> = null):
StringMap<string, any> {
humanizedTemplates: Map<number, {[key: string]: any}> = null):
{[key: string]: any} {
if (isBlank(humanizedTemplates)) {
humanizedTemplates = new Map<number, StringMap<string, any>>();
humanizedTemplates = new Map<number, {[key: string]: any}>();
}
var result = humanizedTemplates.get(template.id);
if (isPresent(result)) {
@ -369,7 +369,7 @@ function testChangeDetector(changeDetectorFactory: Function): string[] {
class CommandHumanizer implements CommandVisitor {
constructor(private result: any[],
private humanizedTemplates: Map<number, StringMap<string, any>>) {}
private humanizedTemplates: Map<number, {[key: string]: any}>) {}
visitText(cmd: TextCmd, context: any): any {
this.result.push(`#text(${cmd.value})`);
return null;

View File

@ -1,11 +1,6 @@
import {describe, it, expect, beforeEach, ddescribe, iit, xit} from 'angular2/test_lib';
import {
ListWrapper,
StringMap,
StringMapWrapper,
MapWrapper
} from 'angular2/src/core/facade/collection';
import {ListWrapper, StringMapWrapper, MapWrapper} from 'angular2/src/core/facade/collection';
export function main() {
describe('ListWrapper', () => {

View File

@ -10,7 +10,7 @@ import {
SpyObject
} from 'angular2/test_lib';
import {Map, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
import {Map, StringMapWrapper} from 'angular2/src/core/facade/collection';
import {RouteRecognizer} from 'angular2/src/router/route_recognizer';
import {ComponentInstruction} from 'angular2/src/router/instruction';

View File

@ -1,4 +1,4 @@
import {StringMap, StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
import {StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
import {
MessageBusSink,
MessageBusSource,
@ -13,11 +13,11 @@ import {NgZone} from 'angular2/src/core/zone/ng_zone';
* Such that whatever goes into one's sink comes out the others source.
*/
export function createPairedMessageBuses(): PairedMessageBuses {
var firstChannels: StringMap<string, MockEventEmitter> = {};
var firstChannels: {[key: string]: MockEventEmitter} = {};
var workerMessageBusSink = new MockMessageBusSink(firstChannels);
var uiMessageBusSource = new MockMessageBusSource(firstChannels);
var secondChannels: StringMap<string, MockEventEmitter> = {};
var secondChannels: {[key: string]: MockEventEmitter} = {};
var uiMessageBusSink = new MockMessageBusSink(secondChannels);
var workerMessageBusSource = new MockMessageBusSource(secondChannels);
@ -30,7 +30,7 @@ export class PairedMessageBuses {
}
export class MockMessageBusSource implements MessageBusSource {
constructor(private _channels: StringMap<string, MockEventEmitter>) {}
constructor(private _channels: {[key: string]: MockEventEmitter}) {}
initChannel(channel: string, runInZone = true) {
if (!StringMapWrapper.contains(this._channels, channel)) {
@ -49,7 +49,7 @@ export class MockMessageBusSource implements MessageBusSource {
}
export class MockMessageBusSink implements MessageBusSink {
constructor(private _channels: StringMap<string, MockEventEmitter>) {}
constructor(private _channels: {[key: string]: MockEventEmitter}) {}
initChannel(channel: string, runInZone = true) {
if (!StringMapWrapper.contains(this._channels, channel)) {