Skip to content

Fix Type Error in shoutConnected Function #40

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

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

heydarideveloper
Copy link
Contributor

Overview
This pull request addresses a TypeScript error encountered when calling the shoutConnected(connection.id) function in the react-signalr package. The error occurs because connection.id can be undefined, while the function expects a parameter of type string | null.

Changes Made
Updated the function call to ensure it only passes a valid string or null value.
Implemented the following modification:

typescript
shoutConnected(connection.id || null);

Benefits
This change prevents TypeScript errors and enhances type safety, ensuring that users of the package do not encounter similar issues when connection.id is undefined.
Testing
Verified that the updated code compiles without any TypeScript errors.
Ensured that the functionality remains intact after the change.
Thank you for considering this fix! I look forward to your feedback. Feel free to adjust any part of this text as needed before submitting your pull request!

@hosseinmd
Copy link
Owner

It is not type error, in the previse version of socket.io before of connection be done we had Id but in new version id is not presented until socket has been connected.
We should change logic.

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.

2 participants