Skip to content

Remove StringMap #4483

@alexeagle

Description

@alexeagle

Discussed with @mhevery:
StringMap is the one strange type, which we use in angular code without importing it, and which we provide to users through a side-channel of listing it directly in the dgeni template for angular2.d.ts but never re-export from the library.
Also, it is unconstrained, every object is a StringMap:

// FIXME: K must be string!
// FIXME: should have an index signature, `[k: string]: V;`
interface StringMap<K extends string, V> {}

It has been the subject of numerous discussions with @vsavkin and @tbosch among others.

Part of the reason it exists is to satisfy Dart users; ts2dart will translate StringMap<string, any[]> to Map<String, List<dynamic>>.

As part of my effort to deliver typings directly from the compiler to users (see #3082) I propose to remove StringMap from our public API, and use the proper TS type, {[k:string]: Type}.
I will first change ts2dart so this change doesn't affect our Dart output.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions