diff --git a/types/underscore.string/index.d.ts b/types/underscore.string/index.d.ts index ce2e46edd1..b06f050fd0 100644 --- a/types/underscore.string/index.d.ts +++ b/types/underscore.string/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/epeli/underscore.string // Definitions by: Ry Racherbaumer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 import * as _ from 'underscore'; diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index c7ab92e0ae..a5db0227d8 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -1,13 +1,14 @@ // Type definitions for Underscore 1.8 // Project: http://underscorejs.org/ -// Definitions by: Boris Yankov -// Josh Baldwin -// Christopher Currens -// Cassey Lottman -// Ard Timmerman -// Julian Gonggrijp +// Definitions by: Boris Yankov , +// Josh Baldwin , +// Christopher Currens , +// Cassey Lottman , +// Ard Timmerman , +// Julian Gonggrijp , +// Florian Keller // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 declare var _: _.UnderscoreStatic; export = _; @@ -3447,9 +3448,9 @@ declare module _ { * @param hashFn Hash function for storing the result of `fn`. * @return Memoized version of `fn`. **/ - memoize( - fn: Function, - hashFn?: (...args: any[]) => string): Function; + memoize( + fn: T, + hashFn?: (...args: any[]) => string): T; /** * Much like setTimeout, invokes function after wait milliseconds. If you pass the optional arguments, diff --git a/types/underscore/underscore-tests.ts b/types/underscore/underscore-tests.ts index e81b848414..1a32063ef5 100644 --- a/types/underscore/underscore-tests.ts +++ b/types/underscore/underscore-tests.ts @@ -285,6 +285,12 @@ var fibonacci = _.memoize(function (n) { return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); }); +class MyClass {}; + +var classMemoized = _.memoize(function (classInstance) { + return new classInstance(); +}); + var log = _.bind(console.log, console); _.delay(log, 1000, 'logged later');