Skip to content

astro-check (warning): Type heroBgUrl in Hero component variants #579

Description

@lsr-explore

Type heroBgUrl in Hero component variants

Labels: types, cleanup
Estimated PR size: 3 files

Note

Ticket description was generated using Claude Code. Review before starting on a fix.

Note

The following issue adds support for npm run astro:check

Summary

Three Hero-style components declare let heroBgUrl; without an initializer or type annotation, producing ts(7043) warnings (implicit any).

astro check warnings

src/components/ColumnedHero.astro:27:5 - warning ts(7043): Variable 'heroBgUrl' implicitly has an 'any' type, but a better type may be inferred from usage.

27 let heroBgUrl;
       ~~~~~~~~~
src/components/Hero.astro:19:5 - warning ts(7043): Variable 'heroBgUrl' implicitly has an 'any' type, but a better type may be inferred from usage.

19 let heroBgUrl;
       ~~~~~~~~~


src/components/HeroWithBreadcrumbs.astro:32:5 - warning ts(7043): Variable 'heroBgUrl' implicitly has an 'any' type, but a better type may be inferred from usage.

32 let heroBgUrl;
       ~~~~~~~~~

Suggested fix

Look at how heroBgUrl is assigned and used in each file, then annotate explicitly. Most likely:

let heroBgUrl: string | undefined;

or

let heroBgUrl: ImageMetadata | undefined;

depending on whether it holds a URL string or an Astro image import.

Acceptance criteria

  • All 3 warnings clear.
  • Hero variants still render correctly on home, blog, and pages with breadcrumbs.

Notes

This is one of the few cases where the three files are nearly identical and a single PR makes sense — keeps the typing consistent across the trio.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions