Skip to content

Add RBS type definitions for Redis hash commands#966

Merged
github-actions[bot] merged 1 commit intoruby:mainfrom
bolshakov:feature/redis-hash
Dec 31, 2025
Merged

Add RBS type definitions for Redis hash commands#966
github-actions[bot] merged 1 commit intoruby:mainfrom
bolshakov:feature/redis-hash

Conversation

@bolshakov
Copy link
Contributor

Introduces type arg = String | Symbol | Integer | Float to represent the only types the Redis client accepts for keys and values.

Methods like hmget and hmset use explicit tuple overloads for common arities (1-7 fields) to provide precise return types. For example, hmget with 3 fields returns [String?, String?, String?] rather than Array[String?]. This enables the type checker to catch arity mismatches and gives callers exact knowledge of the result structure.

Falls back to Array[String?] for 7+ fields where tuple precision becomes impractical.

I skipped two methods - hscan and hscan_each as I never used them and need more type understanding how they work 😅

@github-actions
Copy link

@bolshakov Thanks for your contribution!

Please follow the instructions below for each change.
See also: https://github.com/ruby/gem_rbs_collection/blob/main/docs/CONTRIBUTING.md

Available commands

You can use the following commands by commenting on this PR.

  • /merge: Merge this PR if CI passes

redis

You changed RBS files for an existing gem.
This gem does not have reviewers. So you can merge this PR immediately if the CI passes.
We recommend you add yourself to the reviewers for this gem.

Introduces `type arg = String | Symbol | Integer | Float` to represent the only types the Redis client accepts for keys and values.

Methods like `hmget` and `hmset` use explicit tuple overloads for common arities (1-7 fields) to provide precise return types.
For example, `hmget` with 3 fields returns `[String?, String?, String?]` rather than `Array[String?]`. This enables the type
checker to catch arity mismatches and gives callers exact knowledge of result structure.

Falls back to `Array[String?]` for 7+ fields where tuple precision becomes impractical.
@bolshakov
Copy link
Contributor Author

/merge

@github-actions github-actions bot merged commit 57196ee into ruby:main Dec 31, 2025
5 checks passed
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.

1 participant

Comments