'How do I specify the types for the content (values) of a JS object (i.e. map)?
I want to specify that a Javascript Object, used as a map, contains only a certain type.
For example:
function doSomethingWithUrlQueryParams(queryObj: Object)
Solution 1:[1]
You can use do it like this:
function doSomethingWithUrlQueryParams(queryObj: {[key: string]: string})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Otto |
