Closed Raynos closed 8 years ago
I commented in-line. @matt-esch, could you please add a use case? Most useful would be a code snipped you are trying to describe that requires this.
@Raynos good point about ES6 symbols. We'll also need a way to spec symbols (is there a customary notation for it yet?).
This seems to be handling the object-as-dictionary use case, which in languages with stronger collection types is often annotated Dictionary<TKey, TValue>
as shown here.
@jden correct, I think of Object<S <: String, T <: Any>
as a generic dictionary in javascript.
Until ES6 lands with Map
we will not have an alternative, and even then it will take a long time for Map
to become idiomatic. Note that Object
is like Map
except there is restriction on the Key type to be a subtype of String
.
Added an informal section to the README showing concrete examples for how to express generic objects using jsig.
This fixes #40
cc @Matt-Esch @jden