You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when consuming web components in projects built with Brisa, a type is generated during build-time to let developers know which web components are available.
The names of the web components are defined based on the filename, which was a feasible solution at the time. However, this approach has some limitations:
Current Issues
Type-safety dependency on bun dev: If the bun dev command isn't run, the type-safety for consuming web components does not work.
Navigation in IDEs: When trying to navigate from a server component's code to a corresponding web component within VSCode, the intermediate type definitions file is displayed instead of the actual web component code.
These issues hinder the developer experience and require improvement.
Task
The goal of this task is to research and propose a better approach to address the current issues mentioned above.
Key Objectives
Investigate alternative solutions for type generation that are not dependent on running bun dev for type-safety.
Explore ways to enable smooth navigation in IDEs (e.g., VSCode) from server component code to the actual web component code instead of intermediate type definitions.
Evaluate how these changes could integrate seamlessly into the existing build system.
Existing Implementation
For reference, the current implementation of injected types during build-time can be found here: Injected Types Implementation
aralroca
changed the title
Improving Type-Safety and Developer Experience for Web Components in Brisa
Improving Type-Safety and DX for Web Components in Brisa
Jan 27, 2025
Context
Currently, when consuming web components in projects built with Brisa, a type is generated during build-time to let developers know which web components are available.
The names of the web components are defined based on the filename, which was a feasible solution at the time. However, this approach has some limitations:
Current Issues
bun dev
: If thebun dev
command isn't run, the type-safety for consuming web components does not work.These issues hinder the developer experience and require improvement.
Task
The goal of this task is to research and propose a better approach to address the current issues mentioned above.
Key Objectives
bun dev
for type-safety.Existing Implementation
For reference, the current implementation of injected types during build-time can be found here:
Injected Types Implementation
And implemented here.
The same build-time type works for routes:
Suggestions for Contributions
Feel free to share any insights, questions, or suggestions for improving the type system.
Outcome
The outcome of this task should be:
Note
If no better way is found after investigation, it is also a valid answer to conclude the ticket.
The text was updated successfully, but these errors were encountered: