DefinitelyTyped/types/nice-try/nice-try-tests.ts
Richie Bendall 16b047f880 feat: Add typings for nice-try (#41287)
* feat: Add typings for nice-try

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* feat: Add typings for incorrect parameters

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* fix: Change void to undefined

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Update expected types

Signed-off-by: Richie Bendall <richiebendall@gmail.com>
2020-01-23 12:03:43 -08:00

7 lines
239 B
TypeScript

import niceTry = require("nice-try");
niceTry(() => true); // $ExpectType boolean | undefined
niceTry(() => (1).toString(999)); // $ExpectType string | undefined
niceTry(); // $ExpectType undefined
niceTry(true); // $ExpectType undefined