logoalt Hacker News

tipiirai04/01/20253 repliesview on HN

Author coming out here: Types matter, and Nue’s take is to use them where they truly shine. Adding them to naturally untyped spots like HTML or CSS? That’s just extra weight we can skip.


Replies

dimal04/01/2025

I prefer types over tests everywhere. If I’m passing props to a component and I get a TypeScript error, that’s a test I didn’t need to write or run. I love finding errors like this at compile time instead of at runtime. Just because HTML and CSS are untyped by default doesn’t say anything about whether types are useful for them. Does Nue have any way to protect against those kinds of errors or does some other architectural decision obviate the need for this kind of protection?

I’m not hating on Nue. At first glance, there’s a lot to like here, but I have to disagree on this point.

tossandthrow04/01/2025

Neither HTML, nor CSS are naturally untyped.

Actually, React is not typed enough.

Looking at the mozilla docs: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/sp...

You can see that eg. <span /> is not allowed to hold all types of elelemts.

How awsome weould it be, if th type system actually captures this.

show 2 replies
troupo04/02/2025

Your views are not "naturally untyped spots like HTML or CSS". They are custom templates with custom syntax and logic. And they would definitely benefit from types.