-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: uncomment polymorphic type (#7069)
- Loading branch information
1 parent
dd8dd6b
commit c1669c0
Showing
2 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
'astro': minor | ||
--- | ||
|
||
Added `Polymorphic` type helper to `astro/types` to easily create polymorphic components: | ||
|
||
```astro | ||
--- | ||
import { HTMLTag, Polymorphic } from 'astro/types'; | ||
type Props<Tag extends HTMLTag> = Polymorphic<{ as: Tag }>; | ||
const { as: Tag, ...props } = Astro.props; | ||
--- | ||
<Tag {...props} /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters