mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
18 lines
313 B
Markdown
18 lines
313 B
Markdown
|
---
|
||
|
'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} />
|
||
|
```
|