-
-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Functional Components not allowing inherited attributes #3340
Comments
Here is an example with functional component and component with generic in |
Can't be opened |
i normally make my functional components using arrow functions so i can anotate them with import type { FunctionalComponent } from 'vue'
interface Props {
//
}
const MyComponent: FunctionalComponent<Props, Record<string, string>> = (props) => {
//
} the second generic argument passed to FunctionalComponent |
Hi! first of all thank you for your encouragement, you really send me energy. This can be solved by defining a functional component via import { h, defineComponent } from "vue";
const FooBar = defineComponent(
(props: { stuffAndThings: number; }) => {
return h("div", `Made it: ${props.stuffAndThings}`);
}
) |
Expect to solve |
Closed due to unable to reproduce in latest version. |
When I run
vue-tsc
on a functional component that has e.g. aclass=""
attribute on it, I get an error1:I suspect something changed that makes it not account for attributes that are inherited normally, namely
class
,style
, andonXXX
event listeners (see docs). The demo has more details, but here's the gist of it:Demo: CodeSandbox
P.S.
@johnsoncodehk Thank you for all your hard work on this project! I understand that there's been a large increase in issues recently, so it's all good, don't bend over backwards on this one☺️ . I want to encourage you (and others working on this project), that it's tools like this that make Vue and its ecosystem so enjoyable to use. To me, this language server is a gold standard that other frameworks should try to emulate. Keep up the good work! 🚀
Footnotes
The line numbers may be a bit off, but the message is the same. ↩
The text was updated successfully, but these errors were encountered: