Component type
On the documentation I saw this example :
It should not be
const MyTsComponent = (): Component => {
? Maybe it is a reserved syntax handled by the solid transpilator ?
(sorry if there are some english errors)9 Replies
Ah that should be
Ok but what is the différence between
const MyTsComponent: Component = ()
and const MyTsComponent = (): Component
?The second isn't valid
Oh actually no
It is specific to solid or typescript compliant ?
const MyTsComponent: Component
means 'this function is a component', const MyTsComponent = (): Component
means 'this function returns a component'
but const MyTsComponent(): Component = ()
isn't valid typescript and the docs need to be updated
it's a typescript thingOk I don't have a big experience
I checked on the doc yesterday but nothing was related to this syntax : https://www.tutorialsteacher.com/typescript/arrow-function
I will search more further, I didn't pay attention but it was not the ts documentation
Sorry for that
this:
const MyTsComponent()
is definitely wrong and not supported in Solid in any way... Definitely a typo.
can you create an issue or make a PR to fix or give us a url of where you found this ?