Aller au contenu

htmx ​

Utiliser Hono avec htmx.

typed-htmx ​

Avec typed-htmx, vous pouvez écrire du JSX avec des définitions TypeScript pour les attributs htmx. Vous pouvez suivre le modèle du projet d’exemple typed-htmx pour l’utiliser avec hono/jsx.

Installez le paquet :

sh
npm i -D typed-htmx

Dans src/global.d.ts (ou app/global.d.ts si vous utilisez HonoX), importez les types de typed-htmx :

ts
import 'typed-htmx'

Étendez les types JSX de Hono avec les définitions de typed-htmx :

ts
// A demo of how to augment foreign types with htmx attributes.
// In this case, Hono sources its types from its own namespace, so we do the same
// and directly extend its namespace.
declare module 'hono/jsx' {
  namespace JSX {
    interface HTMLAttributes extends HtmxAttributes {}
  }
}

Voir aussi ​

Publié sous licence MIT.