I'm currently experimenting with converting a large monolithic JavaScript application to TypeScript. I'm having problems with how to correctly type a particular module and I wondered if anyone knows how to do it.

Please note that **the original code was not written by me - I am simply trying to convert an existing application, so if there is anything wrong with the JavaScript, telling me that isn't going to be useful**

Here is the original code for the module (thankfully its quite small).

```
const CACHE_CONTROL_HEADERS = Symbol.for('cache control headers')

if (!global[CACHE_CONTROL_HEADERS]) {
  global[CACHE_CONTROL_HEADERS] = [];
}

module.exports = global[CACHE_CONTROL_HEADERS];

```

Now I've established that TypeScript [does not support using symbols as index signatures](https://github.com/microsoft/TypeScript/issues/1863), so I know I need to cast the first line. I also believe I need to change the last line to ES6 module format, so that leaves me with this:

```
const CACHE_CONTROL_HEADERS = (Symbol.for(
  "cache control headers"
) as unknown) as string;

if (!global[CACHE_CONTROL_HEADERS]) {
  global[CACHE_CONTROL_HEADERS] = [];
}

export default global[CACHE_CONTROL_HEADERS];

```

This now leaves me with the following compile error:

```
index.ts:6:3 - error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Global & typeof globalThis'.
  No index signature with a parameter of type 'string' was found on type 'Global & typeof globalThis'.

```

Now after a bit of googling, I've found various approaches to augmenting the type of the global object, and I've attempted to put the following into a file alongside the module file:

```
declare module NodeJS {
  interface Global {
    [key: string]: string;
  }
}

```

This unfortunately doesn't change the error, and my editor also throws up some other errors on the index signature, e.g.

```
Property 'Array' of type 'ArrayConstructor' is not assignable to string index type 'string[]'

```

At this point, I'm truly stuck. If anyone can help me turn this tiny file into TypeScript, I'd be more than grateful!