From 3f713a91396f8b24644394b80551252c1e68d20b Mon Sep 17 00:00:00 2001 From: Ryan Rhee Date: Tue, 21 Jun 2022 16:29:20 -0400 Subject: [PATCH] Set showHelp return type to never Since `showHelp()` calls into `process.exit()`, they should use the same return type. The return type of `process.exit()` is `never`, not `void`. This tells the typescript compiler that code branches that have `showHelp()` terminate, and that any code written as executing after `showHelp()` should be considered dead code (similar to code after a `return` statement). --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 401530e..30bd960 100644 --- a/index.d.ts +++ b/index.d.ts @@ -268,7 +268,7 @@ export interface Result { @param exitCode - The exit code to use. Default: `2`. */ - showHelp: (exitCode?: number) => void; + showHelp: (exitCode?: number) => never; /** Show the version text and exit.