hapijs / hapi

The Simple, Secure Framework Developers Trust

Home Page:https://hapi.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Types for route.options.payload.multipart don't allow `true`

otajor opened this issue · comments

Runtime

node.js

Runtime version

18.18

Module version

21.3.3

Last module version without issue

No response

Used with

Hapi application

Any other relevant information

The docs for route.options.payload.multipart say that true should be a valid option:
image

But the types file (lib/types/route.d.ts) does not allow this and flags it as an error:

image

The JS code (lib/config.js seems to agree with the docs, so I think the types file is wrong.

image

Can someone confirm what the correct type and usage here should be?

What are you trying to achieve or the steps to reproduce?

Make a route with route.options.payload.multipart set to true. E.g.

payload: {
        maxBytes: 209715200,
        output: 'stream',
        parse: true,
        allow: 'multipart/form-data',
        multipart: true,
      },

What was the result you got?

Typescript error: Type 'true' is not assignable to type 'false | { output: PayloadOutput | "annotated"; } | undefined'

What result did you expect?

true should be an accepted value.