Handling reply.view with @types/hapi

Viewed 265

I have been using hapi with typescript. I was able to write this:

export function displaySignupForm(request: Hapi.Request, reply: Hapi.IReply) {
  reply.view("users/signup");
}

This worked.

The latest update of @types/hapi is 16.1.6, which has backward incompatible changes. The above code doesn't work. I understand now there is ReplyWithContinue and ReplyNoContinue. But I couldn't find a type that includes reply.view.

Which type in the latest @types/hapi has reply.view?

2 Answers

You have the wrong reply interface. It's Hapi.ReplyNoContinue

server.views and reply.view are decorations provided by the Vision plugin, so they are rightfully excluded from the @types/hapi definitions.

Related