Turns out the solution was to declare Memoized as follows:

 * Memoized function that exposes its cache.
type Memoized<T extends Memoizable> = T & Memo<T>

 * A memoized function exposes its cache as a read-only attribute.
interface Memo<T extends Memoizable> {
     * The cache from which memoized items are retrieved.
    readonly cache: Map<string, ReturnType<T>>;

Now the type hint looks like this:

Correct type hint

View the full example on TS Playground

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top