chore: Upgrade compilation target and lib to ES2021#3172
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the TypeScript configuration target and library from ES2020 to ES2021, allowing the direct use of AggregateError instead of a workaround. Feedback on the changes suggests using optional chaining when accessing result.reason.message to prevent potential runtime errors if result.reason is null or undefined.
| const cause = new (global as any).AggregateError(allErrors, 'Stream failure and session failures occurred'); | ||
| const cause = new AggregateError(allErrors, 'Stream failure and session failures occurred'); | ||
|
|
||
| const streamMessage = result.reason.message || 'Unknown stream error'; |
Contributor
There was a problem hiding this comment.
To prevent a potential TypeError if result.reason is null or undefined (or not an object), use optional chaining (?.) when accessing the message property. This aligns with defensive programming practices to ensure that unexpected promise rejection values do not cause unhandled runtime exceptions.
Suggested change
| const streamMessage = result.reason.message || 'Unknown stream error'; | |
| const streamMessage = result.reason?.message || 'Unknown stream error'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Upgrade TypeScript compilation target and standard library configurations from es2020 to es2021. It also cleans up a now-redundant runtime workaround for
AggregateErrorin theMessagingmodule.