Skip to content

Conversation

@shrilakshmishastry
Copy link
Contributor

@shrilakshmishastry shrilakshmishastry commented Sep 14, 2024

Issue

The className property as an object was optional but when the className is provided it was required to provide all the properties declared or needed in className.

From chatGPT the more explanation

classNames?: {
  tags: string,
  tagInput: string,
  tagInputField: string,
  selected: string,
  tag: string,
  remove: string,
  suggestions: string,
  activeSuggestion: string,
  editTagInput: string,
  editTagInputField: string,
  clearAll: string,
}

The ? here means that classNames itself is optional. You can choose to provide or omit this property.
Each property inside the classNames object is required if the classNames object is provided. You must include all these properties with corresponding string values if you use the classNames object.

Solution : make each property optional


classNames?: {
 tags?: string,
 tagInput?: string,
 tagInputField?: string,
 selected?: string,
 tag?: string,
 remove?: string,
 suggestions?: string,
 activeSuggestion?: string,
 editTagInput?: string,
 editTagInputField?: string,
 clearAll?: string,
};

The ? after classNames means that the classNames property itself is optional. When using this type, you might not provide the classNames property at all.
tags?: string and others: Each property inside the classNames object is also optional. This means that you can provide an object with some, all, or none of these properties.

This fixes #983

@vercel
Copy link

vercel bot commented Sep 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-tags ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2024 6:37pm

Copy link
Member

@ad1992 ad1992 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @shrilakshmishastry

@ad1992 ad1992 merged commit b25fb8d into react-tags:master Sep 17, 2024
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.

Unable to specific class names to a subset of elements for the classNames prop following recent TypeScript changes

2 participants