withastro / language-tools

Language tools for Astro
MIT License
272 stars 54 forks source link

🐛 BUG: Using a property as a dynamic tag marks TS props as unused #972

Closed crutchcorn closed 3 weeks ago

crutchcorn commented 1 month ago

Describe the Bug

When using code like this:

---
interface Props {
  as: string;
}

const { as } = Astro.props;
const As = as;
---

<As>
  <slot />
</As>

And running pnpm astro check it shows an error:

error ts(6196): 'Props' is declared but never used.

Steps to Reproduce

  1. npm init astro using template
  2. Use the code above in a component
  3. Run pnpm astro check
  4. Error! error ts(6196): 'Props' is declared but never used.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/astro-check-errors?file=src%2Fcomponents%2FCard.astro&on=stackblitz

Princesseuh commented 3 weeks ago

Duplicate of https://github.com/withastro/compiler/issues/927