Reputation: 78
I understand that we can specify the type of a variable in TypeScript using a colon. Here, _emitters
is a variable which has a type which is specified after the colon sign.
However I am struggling to understand what type is assigned to _emitters
in the below code.
private static _emitters: { [ID: string]: EventEmitter<any> } = {};
It is probably very basic, but unfortunately I am unable to understand it.
Upvotes: 0
Views: 61
Reputation: 4920
It's an object that has keys of type string. Each key of the object holds an EventEmitter.
The example is missing the type of emitted value, eg.
EventEmitter<string>
Upvotes: 1