Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generate-arg-types: Allow multiple exports in component files (#1953)
## Description Allow multiple exports in components. Most radix components will look like `export const Tooltip = TooltipPrimitive.Root;` The others would be a simpe wrappers over radix with just type changes like like `Omit<TriggerProps, "className"> It's too much to create for each sucj export a standalone file. After this PR following will work. ```ts import * as TooltipPrimitive from "@radix-ui/react-tooltip"; export const Tooltip = TooltipPrimitive.Root; export const TooltipTrigger = TooltipPrimitive.Trigger; ``` Generated exports in case of multiple entries are ``` export propsTooltip: ... export propsTooltipTrigger .... ``` In case of single export previous behaviour is preserved for now, but should be changed IMO in the future PRs Known bugs Until this merged we should not use displayName (have no idea why we use it at all) in files with multiple exports styleguidist/react-docgen-typescript#449 As of now will add comments ``` import * as TooltipPrimitive from "@radix-ui/react-tooltip"; export const Tooltip = TooltipPrimitive.Root; // We can't use .displayName until this is merged styleguidist/react-docgen-typescript#449 // Tooltip.displayName = "Tooltip"; export const TooltipTrigger = TooltipPrimitive.Trigger; // We can't use .displayName until this is merged styleguidist/react-docgen-typescript#449 // TooltipTrigger.displayName = "TooltipTrigger"; ``` ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory
- Loading branch information