Tuesday, 18 April 2017

Turning map into plain object for TS declaration

I have this:

let cachedPromises: Map<string, Promise<any>> = new Map();

what is the equivalent declaration for a plain object?

Something like this:

interface IMyMap {
  [key: string]: Promise<any>
}

let cachedPromises: IMyMap = {};

is that sufficient?



via Alexander Mills

No comments:

Post a Comment