nicojs / typed-html

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

Should the library support React style children? #13

Closed bebraw closed 4 years ago

bebraw commented 4 years ago

Thanks a lot for the library. It feels like the missing bit (typed templating). It's an important part of my tailwind-webpack-starter and so far it has worked well. That said, I have an open question.

So far I have

import * as elements from "typed-html";

export default ({ label }) => <div class="btn btn-blue">{label}</div>;

to represent a button but I would prefer to write

import * as elements from "typed-html";

export default ({ children }) => <div class="btn btn-blue">{children}</div>;

and then <Button>demo</Button> when invoking.

I can see createElement would have to deal with this as a special to achieve the mapping above.

Would you accept such a contribution?

bebraw commented 4 years ago

I just realized there's contents (the second parameter of the function). That's enough for my purposes.

Thanks again for the great library!