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

Node: Reduce Non-Null Assertions about BaseClient's config #2679

Open
3 tasks
jhpung opened this issue Nov 13, 2024 · 0 comments
Open
3 tasks

Node: Reduce Non-Null Assertions about BaseClient's config #2679

jhpung opened this issue Nov 13, 2024 · 0 comments
Labels
node Node.js wrapper optimization Optimization which are not performance or a feature per-se.

Comments

@jhpung
Copy link
Collaborator

jhpung commented Nov 13, 2024

Description

I noticed that while the BaseClient constructor's options parameter is marked as optional (options?: BaseClientConfiguration), it's always provided with a non-null value in all creation paths through createClient()[1][2]. This creates an unnecessary nullable context that leads to multiple non-null assertions (!)[1][2][3] throughout the codebase.

This change would make the code more straightforward and remove potentially confusing null-checking context for developers first encountering the codebase. The nullable parameter currently serves no practical purpose since options are always provided during client creation.

Checklist

  • Make the options parameter required or give default value (e.g. {}) in the BaseClient constructor
  • Remove non-null assertions where this.config is used
  • Simplify the type safety guarantees

Additional Notes

No response

@jhpung jhpung added node Node.js wrapper optimization Optimization which are not performance or a feature per-se. good first issue Good for newcomers and removed good first issue Good for newcomers labels Nov 13, 2024
@jhpung jhpung changed the title Node: Reduce Non-Null Assertions abount BaseClient's config Node: Reduce Non-Null Assertions about BaseClient's config Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
node Node.js wrapper optimization Optimization which are not performance or a feature per-se.
Projects
None yet
Development

No branches or pull requests

1 participant