Closed tisonkun closed 3 months ago
Astro.props
isn't typed (well, it's Record<string, any>
) if you don't use a Props
interface or cast it. As such, it's no surprise that trying to cast the destructured value will make an error, this is not a bug.
I would recommend to use the official pattern for typing, instead: https://docs.astro.build/en/guides/typescript/#component-props
@Princesseuh Interesting. I have other similar code but TS compiler doesn't complain.
Seems all involves CollectionEntry.
Anyway, I use interface Props {
method and all works now :D
Describe the Bug
Steps to Reproduce
Put the code snippet above as a component, run
astro check
.Failed with: