I am relatively new to TypeScript and I have a function that returns an object with two functions. Even though I have defined a return interface for it, I encounter an issue when trying to use one of the returned functions.
TS2339: Property 'get' does not exist on type '() => { get: (url: string) => string | null; set: ({ url, body }: SetItemInterface) => void; }'.
Here's the code snippet:
import * as Express from "express";
interface StorageInterface {
[url: string]: {
body: string;
date: number;
};
}
// And so on...
What could be the solution?