rescript-lang / rescript-lang/rescript-lang.org
@directive and @@directive improvements
Nobody has claimed this yet.
- Dominant language
- MDX
- Stars
- 1.9k
- Forks
- 260
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 17
Description
Directives are a part of React and used by the React compiler. Frameworks like NextJs have started to rely on these heavily. ReScript should improve its support in order to take advantages of these features.
Suggested Changes:
-
Always output value given to
@@directiveas a string. Example:@@directive("use client"), not@@directive("'use client'")Currently
@@directivecan generate invalid JS:@@directive("use client")// output use client // should be "use client"Directives are always strings, so we shouldn't need to add internal quotes.
-
Support
@directivefor react components and functions@rescript.component @directive("use client") let make = () => { <div /> } @directive("use server") let submit = (input: FormAction.t) => { await input->save }
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start with the linked React compiler directives documentation, then trace the existing @directive and @@directive handling. Done means @@directive emits a valid string and @directive works on React components and functions as shown in the examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nextjs, react
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100