Using Astro with TypeScript, I'm creating a reusable UI component. The component is just a wrapper for the <a>
HTML tag. The problem is I would have to define the interface Props
with all the general HTML properties for <a>
element by myself (href
, target
, title
, etc.)
Is there a way to avoid this in Astro by extending a certain interface?
---
export interface Props {} // I don't want to define `href`, `target`, etc. by myself here
const props = Astro.props;
---
<a {...props}>
<slot />
</a>
For reference, this is done in React using types such as React.HTMLAttributes<HTMLAnchorElement>