TypeScript Doesn't work as expected after moving from App.vue to a component. #9644
Replies: 2 comments 1 reply
-
Is that I feel like I don't get a full picture here. |
Beta Was this translation helpful? Give feedback.
-
Yes, all of that is in the same component (which is called SideNavigation.vue). It was previously in App.vue, but I moved the related code to a component after seeing that it works well. Only the CSS is not part of the component; it is in a global CSS file, which I use in conjunction with Tailwind. So, App.vue recognizes the object in the global CSS file, but apparently, the component doesn't recognize it. The error is thrown specifically when I create the arrow function. I verified that I didn't miss any import statements when I moved the code from App.vue to the custom component I created.
(By the way, this led me to discover a bug in Volar. Even after removing the function, the error message indicating an issue in this function persists, but it is unrelated to my question in this particular issue.) So, the idea is that Tailwind detects this class from the main CSS file. When I add a button or any other function, it works because of the class I created and introduced in the Tailwind config file. The only issue is that TypeScript gives me this error when I add this function, which I clearly see has no error in it.
I have tried various alternatives to achieve this task in a different way. The bug in Volar extension may lead me to make a mistake because, as I mentioned, the error message remains unchanged even after removing this specific code. Therefore, when I attempt other approaches, it doesn't help me verify whether it produces an error or not. The actual code is in my home office computer, I can share more details this evening. |
Beta Was this translation helpful? Give feedback.
-
Problem: After moving my code from App.vue to a component, the same typescript code started giving the following error:
Vue Version: 3.3.4
Expected behavior: It should work without error just like when it was in App.vue file.
Related Css:
Beta Was this translation helpful? Give feedback.
All reactions