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

fix: typescript error input & use-toast hook #5232

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

prajnaprabhu3
Copy link

@prajnaprabhu3 prajnaprabhu3 commented Oct 7, 2024

closes #5201

  • changes made for every style
  • updated the documentation
  • updated the registry

use-toast.ts

Error
here the error was actionTypes defined as const was only being used as a type in ActionType.

Changes Made

  • I have directly used actionTypes in the reducer logic.
  • Instead of strings like "ADD_TOAST" etc, I have used actionTypes.ADD_TOAST and so on

Other Solution

  • So we can eliminated actionTypes completely by using the below structure for type Action
type Action =
  | {
      type: "ADD_TOAST"
      toast: ToasterToast
    }
| {
      type: "UPDATE_TOAST"
      toast: Partial<ToasterToast>
    }
  • if this is something that's prefered, happy to make the changes

input.tsx

Error
An interface declaring no members is equivalent to its supertype

Changes made
So the InputProps was extending React.InputHTMLAttributes<HTMLInputElement> without adding any additional props. So have directly used the prop type without using an interface

 React.forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>

Other Solution
Let me know if there is a better way to do this

Copy link

vercel bot commented Oct 7, 2024

@prajnaprabhu3 is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Author

Choose a reason for hiding this comment

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

actionTypes can be completely avoided as well.

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.

[bug]: Deployment build error for input and use-toast
1 participant