valkey-io/valkey-glide

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

开放

#2,679 创建于 2024年11月13日

 (5 条评论) (0 个反应) (2 位负责人)Java (166 个派生)auto 404
Task 🔧Users Paingood first issuenode 🐢

仓库指标

星标
 (762 个星标)
PR 合并指标
 (平均合并 7天 22小时) (30 天内合并 94 个 PR)

描述

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

贡献者指南