https://pact.io logo
#pact-js
Title
# pact-js
a

Artur Neumann

03/07/2022, 7:07 AM
m

Matt (pactflow.io / pact-js / pact-go)

03/07/2022, 7:09 AM
I think I should update the Typescript type to prevent the use of undefined in the parameters - that’s the first step
but it won’t fix JS users, so it will need some validation also
I think we should explictly error if we find
undefined
because it may lead to unintended consequences
👍 1
In your case, I’m not sure what works best - replacing
undefined
with
null
or some alternative?
a

Artur Neumann

03/07/2022, 7:12 AM
I'm trying now
Copy code
optionalParams = JSON.stringify(optionalParams)
  optionalParams = JSON.parse(optionalParams)
that should delete all keys with undefined values
💯 1
message has been deleted
THX
m

Matt (pactflow.io / pact-js / pact-go)

03/07/2022, 7:41 AM
Excellent! Thanks for letting me know. I'll fix the above in the next release (next few days)
I’ve made a patch locally for this. It’s not my ideal solution, but having it will prevent a regression and provide a target for addressing later.
I’ll push it up in the next couple of days