No index signature with a parameter of type 'string' was found on type

You generally don't want to use new Object(). Instead, define map like so:

var map: { [key: string]: any } = {}; // A map of string -> anything you like

If you can, it's better to replace any with something more specific, but this should work to start with.


You need to declare a Record Type

var map: Record<string, any> = {};

https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeystype


As @Tim Perry mentioned above, use object directly. What I would recommend is to build your own dictionary.

declare global {
   type Dictionary<T> = { [key: string]: T };
}

Then you would be able to use

const map: Dictionary<number> = {} // if you want to store number.... 

Which is easier to read.