Closed mrmckeb closed 1 month ago
@mrmckeb makes sense, happy to accept a PR here. Thanks!
I took a look at this and I see two options:
undefined
supported.Either option will likely require more changes over time, as option 1 still won't prevent new code from being added that doesn't include undefined
when the type is optional.
What do you think @silesky?
@mrmckeb -- definitely the one with the least amount of code changes, that ideally only touches the public APIs (i.e. Params). Thanks!
Done - sorry it took so long @silesky! https://github.com/segmentio/analytics-next/pull/1156
This is a quick change, and I'm happy to contribute.
When using TypeScript with
exactOptionalPropertyTypes
, we get errors because Segment types don't allowundefined
to be supplied to optional values.The fix is that whenever a type is optional, it should also allow undefined.
As an example: