-
Notifications
You must be signed in to change notification settings - Fork 327
Description
📚 Subject area/topic
use:* directives
📋 Page(s) affected (or suggested, for new content)
https://docs.solidjs.com/reference/jsx-attributes/use
https://www.solidjs.com/guides/typescript#use___
📋 Description of content that is out-of-date or incorrect
The use:* directives content seems to be very minimal, I didn't see a page or section covering it in the learn/concepts section and the page in reference seems very minimal.
Aside from fixing the typo in the example (";" before the input), I think it would be nice to have more of an explanation of what directives are useful for and maybe another example or 2.
I tried setting up a directive and passing in a object rather than an array and typescript was not happy about it. It also kept showing my directive as not being used even though it was in use. After searching through the discord I found a comment point to https://www.solidjs.com/guides/typescript#use___ which clarifies that the Directives interface is the old way of defining them and DirectiveFunctions is the new way.
The new docs does have this info as well, but just in the typescript section. This should definitely at least be linked to by the main directive section so it is easier to find when you go looking for use:/directives rather than needing to look for Typescript. I think some of the content in the typescript section should also be in the main use: page because it is important context. Like how bundlers might treeshake imported directives and how to fix that and maybe a callout to the type definition stuff.
Important: use: is detected by the compiler to be transformed, and the function is required to be in scope, so it cannot be part of spreads or applied to a component.
🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)
No response