717 karma · joined February 18, 2013
First few exams and I had WAY better marks than all of them, lol.
You could have:
type Result = {type: 'ok', value: string} | {type: 'err', value: string}
It would be easy to just say "yes, I got a bit carried away with the naming and my big future plans, but the community reaction made me realise perhaps it was not a great idea"
Insead he's like: "what? it was the plan all along :)"
A better naming for 99% of cases is (like found in Elm)
type Result error value = Ok value | Err error
As the maintainer, you don't want to cave in and add every possible configuration option people ask for so you have to decide what's a good, thin API for your component and it will never be enough for some usages. Styles are that much more subjective and even vary with design trends over the years!
It might be possible for very, very simple components like text inputs but then again, those are also the simplest to code directly in your framework, so you could wonder, why bother with an inferior programming paradigm in the first place?
The sweet spot for web components really seems tiny.
You could use the allowJs typescript flag and mostly use JS files at first; perhaps only typing a few models.
The difference is even more pronounced once you start typing your code.
TS/TSX = 100% typed
arbitrary template DSL = 0% typed
and now these string template based on interpolation = 5% typed: Only the dynamic values inside ${} expressions are "typed", but there are no coherence checks. DOM attribute names and values remain untyped
In the absence of any real advantage for string templates, why even bother?
JS was so poorly designed. An implicit (not passed as an arg), dynamic this parameter. You couldn't be more cheeky than that really.
something like console.log.bind(console.log) is beyond silly. It's what we're stuck with but I will minimize the occurences of that kind of crap any single time I can.
Pete Hunt always said he saw React components as mini MVC modules.
it's even less true nowadays with features like Context or suspense to supplement the component states. Redux was kind of a temporary hack.
Even dumber than the "Hey, why should we care about the environment since a few countries can decide not to"
Perhaps it's time to start reading about UX , browser JS parsing speed, how JS executes, etc.
Making your dev life easier is nice, but don't forget the end goal...
(Note: I'm not talking about those internal apps that have 10 users :p)