As per documentation, the way to import the MemoryCache class is
import { MemoryCache } from 'memory-cache-node';
which doesn't work because MemoryCache is exported as default - as per MemoryCache.d.ts:
export default class MemoryCache<K, V>
and the above import statement gives SyntaxError: The requested module 'memory-cache-node' does not provide an export named 'MemoryCache' error.
So the import that actually works is
import MemoryCache from 'memory-cache-node';
But then you gotta use it like
const cache = new MemoryCache.MemoryCache<string, number>(30, 50000);
otherwise you get TypeError: object is not a constructor.
I'm using es6 modules, if it's relevant.
As per documentation, the way to import the
MemoryCacheclass iswhich doesn't work because MemoryCache is exported as
default- as perMemoryCache.d.ts:and the above import statement gives
SyntaxError: The requested module 'memory-cache-node' does not provide an export named 'MemoryCache'error.So the import that actually works is
But then you gotta use it like
otherwise you get
TypeError: object is not a constructor.I'm using es6 modules, if it's relevant.