[fix] encoding
is still required in TS even though it has default value from co-body
#155
Closed
3 tasks done
Labels
Describe the bug
Node.js version: 18.6.1
OS version: macOS 12.6
Description: When I used the v5 of this lib, I am getting a type error from the
encoding
field being required but theREADME.md
says that it has a default value suggesting it isn't required.bodyparser/README.md
Line 50 in 664cd7c
Another thing is that
encoding
is not being passed on to theco-body
'sparse
function so it seems useless compared to v4 where it usescopy-to
'scopy
function to merge options.bodyparser/index.js
Lines 50 to 111 in 5678a79
compared to v5 where it limits the options
bodyparser/src/body-parser.ts
Lines 63 to 73 in 664cd7c
so I'm not entirely sure if we should document this as breaking changes that we're not able to override the
encoding
or any other values or fix this type of issue.Also, I think it's an issue with
co-body
type declaration where they explicitly putundefined
as part of the type telling us to explicitly pass a value ofundefined
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/def5996adb3596c8c468922ed0ac55110cd47fcc/types/co-body/index.d.ts#L33-L42
Actual behavior
Expected behavior
Should not be getting any type of error
Code to reproduce
For whatever reason, I wasn't able to replicate it in the TS playground but I was able to replicate it in CodeSandbox.
Workaround
Checklist
The text was updated successfully, but these errors were encountered: