nicojs / typed-html

TypeSafe HTML templates using TypeScript. No need to learn a template library.
333 stars 51 forks source link

Why are HTML tags declared as strings? #21

Open codethief opened 3 years ago

codethief commented 3 years ago

Forgive my ignorance but why does the example from the README

// example.tsx
import * as elements from 'typed-html';

const w = 'world';
const helloWorld = <p>Hello <strong>{w}</strong></p>;

typeof helloWorld; // => Just a string of course

yield a string? Wouldn't it make more sense for helloWorld to be of type HTMLElement, so that

1) it can be easily appended to existing DOM elements? 2) everything's type-safe and one could do introspection on those HTMLElements?

TechStudent10 commented 1 year ago

2. everything's type-safe and one could do introspection on those HTMLElements?

I'm also curious about this

arthurfiorette commented 1 year ago

This package aims to generate html strings. Probably looking for https://github.com/alex-kinokon/jsx-dom#readme