No you're right the first time. _properties is a map of string
to string
.
Here's an example on the TypeScript Playground demonstrating the expected error.
If you can link an example where that statement is valid we can figure out why.
문제
I looked into some TypeScript source code lately and came across a property typed like this:
private _properties: {[name:string]: string};
I asked myself what this type refers to? What is it exactly?
I thought it would be an object where key and value need to be string.
But I tried it in the TypeScript Playground and saw that something like
this._properties['name'] = 5;
is also valid. So what's the complete explanation of this type?
해결책
No you're right the first time. _properties is a map of string
to string
.
Here's an example on the TypeScript Playground demonstrating the expected error.
If you can link an example where that statement is valid we can figure out why.