Skip to content
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

Add Schmervice types and improve server decorations #1

Open
ianjkaplan opened this issue Sep 26, 2021 · 0 comments
Open

Add Schmervice types and improve server decorations #1

ianjkaplan opened this issue Sep 26, 2021 · 0 comments

Comments

@ianjkaplan
Copy link
Collaborator

ianjkaplan commented Sep 26, 2021

Schmervice types in definitely typed are a good starting point so I ported them and have added tsd type declaration tests since I prefer making explicit type assertions in tests.

I want to update the the decorator functions the to accept a string or true rather than an optional boolean since the function also take string arguments that correspond to namespaces. It would look something like the following

declare module '@hapi/hapi' {
    interface Server {
        /**
         * decorations can be passed a plugin namespace or a boolean to return all registered services
         * @param all
         */
        services: (all?: true | string) => RegisteredServices;
    }

    interface Request {
        services: (all?: true | string) => RegisteredServices;
    }

    interface ResponseToolkit {
        services: (all?: true | string) => RegisteredServices;
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant