I am trying to create a factory function that returns an object with a setter and getter. The object represents a predefined pseudo cache that can save data to a property. Here is my example:

```
interface CacheData {
  accessToken: string;
  expiration: number;
}

function cacheFactory(data: CacheData) {
  const cache: CacheData = data;
  return {
    getItem(key: string) {
      return cache[key as keyof CacheData];
    },
    setItem(key: string, value: unknown) {
      cache[key as keyof CacheData] = value; // HERE I GET THE ERROR!
    },
  };
}

```

[Playground](https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgMKIBYQCJzHZAbwChllEkBnSgFQHsBrCEALmUrClAHMBuU5BAAeAB2BQ8wOq2QgArgFsARtH4BfYsRhyQCMFJDIEmCADFEYOlACeACgAmeOG3QIsufAEoiAhNI5GJi4mHgQAvMiO%20PxkUBBgclCGJGRk3PEAkpAKtkzWbBxcINzeKamx8YmGxm4QANp55JTIeXQwaCFOALoxqWoANAJklJnZuRD57Jw8-cgAbnAANnIQbDoMIHQA7iClQ6k1WA0TTS0TbR21oV3IEQvLEL1kAwJq6kA)

I receive the error `Type 'unknown' is not assignable to type 'never'.` at `cache[key as keyof CacheData] = value;`

How can I solve this error?