I would like to store a mapping of string -> string in a Typescript object, and enforce that all of the keys map to strings. For example:
var stuff = {};
st
interface AccountSelectParams {
...
}
const params = { ... };
const tmpParams: { [key in keyof AccountSelectParams]: any } | undefined = {};
for (const key of Object.keys(params)) {
const customKey = (key as keyof typeof params);
if (key in params && params[customKey] && !this.state[customKey]) {
tmpParams[customKey] = params[customKey];
}
}
please commented if you get the idea of this concept