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

(Typescript) Allow ReadonlyArrays as valid classNames parameters #307

Merged
merged 3 commits into from Apr 27, 2023

Conversation

BenGearset
Copy link
Contributor

@BenGearset BenGearset commented Apr 27, 2023

Simple reproduction:

const array = ['a', 'b', 'c'] as const;
classNames(array);

Error:

TS2345: Argument of type '[readonly ["a", "b", "c"]]' is not assignable to parameter of type 'ArgumentArray'.   Type 'readonly ["a", "b", "c"]' is not assignable to type 'Argument'.     Type 'readonly ["a", "b", "c"]' is not assignable to type 'Mapping'.       Index signature for type 'string' is missing in type 'readonly ["a", "b", "c"]'.

This PR adds a ReadonlyArray<Argument> to the Argument union type allowing ReadonlyArrays to be used with classNames

Copy link
Collaborator

@dcousens dcousens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @BenGearset

@dcousens dcousens added the types label Apr 27, 2023
@dcousens dcousens merged commit 0251060 into JedWatson:main Apr 27, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants