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
@@ -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]]),
@@ -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 {}
@@ -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;
@@ -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;
@@ -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', () => {