Skip to content

astro-check (warning): Add missing module type declarations (sanitize-html, ~bootstrap-es) #578

@lsr-explore

Description

@lsr-explore

Add missing module type declarations (sanitize-html, ~bootstrap-es)

Labels: types, dependencies
Estimated PR size: 1–2 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

Two third-party modules are imported without TypeScript declarations, producing ts(7016) warnings. Both are easy fixes.

astro check warnings

src/pages/tips/rss.xml.ts:17:27 - warning ts(7044): Parameter 'context' implicitly has an 'any' type, but a better type may be inferred from usage.

17 export async function GET(context) {
                             ~~~~~~~
src/pages/tips/rss.xml.ts:12:10 - warning ts(6133): 'components' is declared but its value is never read.

12 import { components, sanitizeOptions } from "src/lib/mdx";
            ~~~~~~~~~~
src/pages/tips/rss.xml.ts:2:26 - warning ts(7016): Could not find a declaration file for module 'sanitize-html'. '/Users/laurie/dev/accessible-community/ac-website/accessiblecommunity.github.io/astro/node_modules/sanitize-html/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/sanitize-html` if it exists or add a new declaration (.d.ts) file containing `declare module 'sanitize-html';`

2 import sanitizeHtml from "sanitize-html";
                           ~~~~~~~~~~~~~~~

src/components/navigation/NavSiteSecondary.astro:109:38 - warning ts(7016): Could not find a declaration file for module '~bootstrap-es'. '/Users/laurie/dev/accessible-community/ac-website/accessiblecommunity.github.io/astro/node_modules/bootstrap/dist/js/bootstrap.esm.min.js' implicitly has an 'any' type.

109   import { Collapse, Dropdown } from "~bootstrap-es";
                                         ~~~~~~~~~~~~~~~

src/layouts/DAFLayout.astro:19:19 - warning ts(6133): 'title' is declared but its value is never read.

19 const { metadata, title } = Astro.props;
                     ~~~~~


src/layouts/DAFLayout.astro:65:42 - warning ts(7016): Could not find a declaration file for module '~bootstrap-es'. '/Users/laurie/dev/accessible-community/ac-website/accessiblecommunity.github.io/astro/node_modules/bootstrap/dist/js/bootstrap.esm.min.js' implicitly has an 'any' type.

65       import { Collapse, Dropdown } from "~bootstrap-es";
                                            ~~~~~~~~~~~~~~~

src/components/Header.astro:234:38 - warning ts(7016): Could not find a declaration file for module '~bootstrap-es'. '/Users/laurie/dev/accessible-community/ac-website/accessiblecommunity.github.io/astro/node_modules/bootstrap/dist/js/bootstrap.esm.min.js' implicitly has an 'any' type.

234   import { Collapse, Dropdown } from "~bootstrap-es";
                                         ~~~~~~~~~~~~~~~


src/components/HeaderER.astro:167:38 - warning ts(7016): Could not find a declaration file for module '~bootstrap-es'. '/Users/laurie/dev/accessible-community/ac-website/accessiblecommunity.github.io/astro/node_modules/bootstrap/dist/js/bootstrap.esm.min.js' implicitly has an 'any' type.

167   import { Collapse, Dropdown } from "~bootstrap-es";
                                         ~~~~~~~~~~~~~~~

Suggested fix

1. sanitize-html

cd astro
npm install --save-dev @types/sanitize-html

Commit package.json and package-lock.json.

2. ~bootstrap-es

This is a Vite alias (~bootstrap-esbootstrap/dist/js/bootstrap.esm.min.js) defined in the project's Vite/Astro config. Add a small .d.ts shim in astro/src/ (or wherever the project keeps ambient types):

// astro/src/types/bootstrap-es.d.ts
declare module "~bootstrap-es" {
  export * from "bootstrap";
}

Verify the chosen path is included by tsconfig.json (the default "include" of src/**/* should catch it).

Affected files

  • astro/package.json, astro/package-lock.json (sanitize-html)
  • astro/src/types/bootstrap-es.d.ts (new) — or wherever the existing ambient types live

Acceptance criteria

  • All 6 ts(7016) warnings clear.
  • npm install from astro/ succeeds.
  • No new errors introduced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions