Skip to content
This repository was archived by the owner on May 25, 2025. It is now read-only.

Commit 08ffc05

Browse files
authored
Merge pull request #129 from breeffy/branch-exit-return-never
fix: return never from exit functions
2 parents 00cbaa0 + d878c60 commit 08ffc05

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/exit.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ export class Exit {
2323
/**
2424
* Stop the action with a "success" status
2525
*/
26-
public success (message?: string) {
26+
public success (message?: string): never {
2727
if (message) this.logger.success(message)
2828
process.exit(SuccessCode)
2929
}
3030

3131
/**
3232
* Stop the action with a "neutral" status
3333
*/
34-
public neutral (message?: string) {
34+
public neutral (message?: string): never {
3535
if (message) this.logger.info(message)
3636
process.exit(NeutralCode)
3737
}
3838

3939
/**
4040
* Stop the action with a "failed" status
4141
*/
42-
public failure (message?: string) {
42+
public failure (message?: string): never {
4343
if (message) this.logger.fatal(message)
4444
process.exit(FailureCode)
4545
}

tests/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Toolkit', () => {
3737

3838
it('logs and fails when the function throws an error', async () => {
3939
const err = new Error('Whoops!')
40-
const exitFailure = jest.fn()
40+
const exitFailure = jest.fn<never, any>()
4141

4242
await Toolkit.run(async twolkit => {
4343
twolkit.exit.failure = exitFailure

0 commit comments

Comments
 (0)