DefinitelyTyped/types/promise-memoize/promise-memoize-tests.ts
Emily Marigold Klassen 3b1a21e700 Add types for promise-memoize (#30568)
* Add types for promise-memoize

* fixup! Add types for promise-memoize

* Add clear to promise-memoize tests
2018-11-16 15:58:40 -08:00

15 lines
270 B
TypeScript

import promiseMemoize = require('promise-memoize');
async function lastPosts(n: number) {
return n + 1;
}
const cachedLastPosts = promiseMemoize(lastPosts, {maxAge: 60000});
// Later...
cachedLastPosts(10).then(posts => {
posts;
});
cachedLastPosts.clear();