Skip to content

Conversation

@som-sm
Copy link
Collaborator

@som-sm som-sm commented Sep 30, 2025

Now that we have TupleOf exposed, I don't think we need a separate ReadonlyTuple type because it simply wraps the result of TupleOf in Readonly.

This PR also refactors the implementation of ReadonlyTuple to use TupleOf, which in turn fixes the following bug wherein the type wasn't distributing over the Length argument.

type Current = ReadonlyTuple<string, 3 | 4>;
//=> readonly [string, string, string]

type Fixed = ReadonlyTuple<string, 3 | 4>;
//=> readonly [string, string, string] | readonly [string, string, string, string]

@som-sm som-sm requested a review from sindresorhus September 30, 2025 13:43
@sindresorhus
Copy link
Owner

@som-sm
Copy link
Collaborator Author

som-sm commented Sep 30, 2025

Maybe worth adding it to https://github.com/sindresorhus/type-fest?tab=readme-ov-file#alternative-type-names too?

Yeah, I thought this too, but do you wanna add this now or after we have removed the type?

@sindresorhus
Copy link
Owner

We can just do it now. When I type is deprecated, we can just pretend it doesn't exist.

@sindresorhus sindresorhus merged commit af4bebc into main Sep 30, 2025
6 checks passed
@sindresorhus sindresorhus deleted the fix/deprecate-readonly-tuple branch September 30, 2025 18:37
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.

3 participants