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(types): add explicit return type for useToast to resolve ts(2742)… #837

Closed
wants to merge 1 commit into from

Conversation

Dam998
Copy link

@Dam998 Dam998 commented Oct 27, 2024

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR resolves the TypeScript error ts(2742), which caused an issue with the inferred type of the useToast function in the use-toast.ts file. The error was due to the inferred type depending on an internal @vue/shared reference, making it non-portable.

Added an explicit return type for the useToast function to ensure the type is portable and compatible with the project's type-checking settings.

📸 Screenshots (if appropriate)

N/A

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@sadeghbarati
Copy link
Collaborator

Hi, Thanks for the PR could you please share a screenshot that has that TypeScript error you mentioned?

@Dam998
Copy link
Author

Dam998 commented Oct 28, 2024

hi @sadeghbarati
here is a screenshot showing the error:

image

@sadeghbarati
Copy link
Collaborator

@Dam998 On my end TypeScript types are ok ✅, I think there is some error within your packageManager, maybe it's related to caching or related to the old package manager version you using

image


Please try these steps ensure you are using the right Vue-related extensions

  • In the VSCode extension tab search for the filter icon and filter built-in and search for TypeScript and if it is disabled, enable it

  • If you have TypeScript Vue Plugin (Volar) uninstall it

  • Install Vue - Official

  • Remove node_modules clear your packageManger cache and install everything again

@Dam998
Copy link
Author

Dam998 commented Oct 28, 2024

@sadeghbarati I found the issue: it was pnpm causing the conflicts. I resolved it by switching to Yarn, and now everything is working correctly. I appreciate your support!

@Dam998 Dam998 closed this Oct 28, 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.

2 participants