typescript key as string

The solution for “typescript key as string” can be found here. The following code will assist you in solving the problem.

// This is a key/value structure. The key is a string and the value is a boolean. For example:
let map : { [key: string]: boolean} = {};
map[“foo”] = true;
map[“bar”] = false;
map.foo = true;
map[“foobar”] = “foo”; // Throws exception
map[1] = true; // Curiously doesn’t throws exception

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in