balteo
balteo

Reputation: 24709

Doubts about a typescript syntax found within the documentation

I am in reference to the typescript documentation about advanced types. See here.

The following example is given:

interface Map<T> {
   [key: string]: T;
}

I understand the Map's type variable T.

My doubt is rather about the syntax within the interface declaration i.e. this exact line:

[key: string]: T;

Upvotes: 0

Views: 44

Answers (1)

balteo
balteo

Reputation: 24709

I have found the answer to my question. It is a Typescript Index Signature.

See following link for a comprehensive explanation: https://basarat.gitbooks.io/typescript/docs/types/index-signatures.html

Upvotes: 1

Related Questions