GitAuto: makeBrowserOfflineTransport no longer adds types to transportOptions #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #3
Why the bug occurs
In version 8.33.1 of the Sentry SDK, the
makeBrowserOfflineTransport
function no longer includes theflushAtStartup
property in thetransportOptions
type definition. This omission causes TypeScript to throw an error whenflushAtStartup
is specified, as it is not recognized within thePartial<BrowserTransportOptions>
type. The regression from version 7.60.0 disrupts existing implementations that rely on this option for ensuring that pending events are flushed when the application starts.How to reproduce
makeBrowserOfflineTransport
, including theflushAtStartup
option intransportOptions
:How to fix
Update Type Definitions: Extend the
BrowserTransportOptions
interface to include theflushAtStartup
property. This ensures that TypeScript recognizesflushAtStartup
as a valid option.Modify Transport Creation: Ensure that
makeBrowserOfflineTransport
correctly utilizes the extendedBrowserOfflineTransportOptions
type.Validate Changes: After updating the type definitions, verify that the TypeScript error is resolved by initializing Sentry without needing to cast
transportOptions
.Add Tests: Include unit tests to ensure that
flushAtStartup
is correctly handled within the transport options and that no TypeScript errors occur in various configurations.Additional Notes
flushAtStartup
was previously supported, adding it back to the type definitions restores expected functionality without breaking existing implementations.flushAtStartup
intransportOptions
, providing examples and explanations for its usage.Test these changes locally