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

[RUMF-1034] allow passing undefined options to RUM and Logs init #1082

Merged
merged 4 commits into from
Sep 29, 2021

Conversation

BenoitZugmeyer
Copy link
Member

Motivation

TS 4.4 introduced a new option called exactOptionalPropertyTypes, that disallows passing undefined to optional properties. Example:

interface Options {
  foo?: number
}

let options: Options = {
  foo: undefined // this will raise an error with `exactOptionalPropertyTypes: true`
}

To ease SDK integration in projects that are using this TS option, we want to explicitly allow passing undefined as a value for optional properties.

Changes

  • add a small compatibility test to check for this configuration
  • explicitly allow undefined for all init configuration optional properties

Testing

CI


I have gone over the contributing documentation.

Copy link
Contributor

@bcaudan bcaudan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it worth doing it for other public APIs?
like setUser({id: undefined})

@BenoitZugmeyer BenoitZugmeyer merged commit 7ca6755 into main Sep 29, 2021
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/exact-optional-property-types-support branch September 29, 2021 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants