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

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

Closed
otajor opened this issue May 20, 2024 · 1 comment
Closed

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

otajor opened this issue May 20, 2024 · 1 comment
Labels
bug Bug or defect

Comments

@otajor
Copy link

otajor commented May 20, 2024

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.

@damusix
Copy link
Contributor

damusix commented Jun 15, 2024

@otajor fixed in #4507

@damusix damusix closed this as completed Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or defect
Projects
None yet
Development

No branches or pull requests

2 participants