You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a point about the specification itself (and I do hope that it's OK to report it here).
In an Index Signature -- currently documented in these paragraphs -- there is the BindingIdentifier.
Based on my own testing, based on an answer to this question on StackOverflow, and based on some blog posts the precise choice of the BindingIdentifier in an index signature does not matter to TypeScript.
It seems like one can choose an arbitrary value, and people seem to like key or index to make the intent explicit, readable. Let me quote this resource:
the name of the index signature e.g. index in { [index:string] : {message: string} } has no significance for TypeScript and is only for readability.
Now, I am new to TypeScript, and I really wanted to see a comment on that aspect in the source of truth, in the language specification. But I couldn't find that part commented on in section 3.9.4, and also not elsewhere in the spec. I have probably missed it elsewhere.
Action items depend on answers to these questions:
is that behavior specified somewhere in the spec?
if it is: should we link to that from section 3.9.4?
if it is not commented on in the spec: should this be added somewhere?
The text was updated successfully, but these errors were encountered:
Forget about the spec. It's not maintained at all and heavily outdated. The last real update was done in January 2016, almost 3 years ago. So realistically TypeScript has no specification anymore.
The specific identifier used in an index signature is like the the names of parameters in a function type: it doesn’t affect anything at compile time, it’s just there for documentation.
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow.
This is a point about the specification itself (and I do hope that it's OK to report it here).
In an Index Signature -- currently documented in these paragraphs -- there is the
BindingIdentifier
.Based on my own testing, based on an answer to this question on StackOverflow, and based on some blog posts the precise choice of the
BindingIdentifier
in an index signature does not matter to TypeScript.It seems like one can choose an arbitrary value, and people seem to like
key
orindex
to make the intent explicit, readable. Let me quote this resource:Now, I am new to TypeScript, and I really wanted to see a comment on that aspect in the source of truth, in the language specification. But I couldn't find that part commented on in section 3.9.4, and also not elsewhere in the spec. I have probably missed it elsewhere.
Action items depend on answers to these questions:
The text was updated successfully, but these errors were encountered: