nicojs / typed-html

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

Added support for creating wrapper elements using functions #4

Closed derekhawker closed 6 years ago

derekhawker commented 6 years ago

Hi,

I wanted to add support for Stateless components like React allows as seen in the first example here . https://reactjs.org/docs/components-and-props.html

It was basically just a one line fix to check if the createElements callback was getting a function or not. I couldn't get the interface to look exactly like in React since it does fancier stuff to sort out props and children elements. So to avoid a children attribute showing up in all the elements, I added a second parameter specifically for that.

I added tests and reran against the existing suite.

derekhawker commented 6 years ago

I'm a bit new to the github PRs. Let me know if I need to squash my commits and force-push or anything like that.

EDIT: My bad, I have a misnamed parameter usage in the readme.md. I will update after your next round of comments

derekhawker commented 6 years ago

Hi, some updates as discussed above. I went back and fixed some inconsistent usages of commas in the spec.

nicojs commented 6 years ago

I'm a bit new to the github PRs. Let me know if I need to squash my commits and force-push or anything like that.

Don't worry about it. I'll squash and merge using the new github feature. You may also add yourself to the contributor list if you want. Or I can do it for you 👍

derekhawker commented 6 years ago

Sorry, xmas break.

Hope you don't mind, but I was curious to see what happens in a review if I pre-squash my commits. Turned out I had misnamed a pre-existing spec description, so I undid that.

nicojs commented 6 years ago

Just released 0.6