Skip to content

feat: add local typings #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Type definitions for @hapipal/avocat 3.0
// Project: https://github.com/hapipal/avocat#readme
// Definitions by: Tim Costa <https://github.com/timcosta>

import { ResponseObject } from '@hapi/hapi';
import { Boom } from '@hapi/boom';

export interface Options {
return?: boolean | undefined;
includeMessage?: boolean | undefined;
}

// the return type has to be any because the following scenarios exist:
// 1. options.return = false - this will always throw or return false
// 2. options.return = true - this will either return false or a Boom type
// Due to scenario 2 and that behavior changes based on options, a return
// type of any is the only way I see this working
export function rethrow(err: ResponseObject | Boom, options?: Options): any;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "A utility to convert Objection database errors into Boom HTTP errors",
"version": "3.1.0",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"author": "Daniel COLE <[email protected]>",
"repository": {
"type": "git",
Expand Down