Show HN: Jtype – a rudimentary type system for JavaScript
github.com
github.com
> Why add transpilation and a tool chain, and change your code, and add a whole bunch of assumptions, when you can write a rudimentary type system in JS in a couple hundred lines.
1) Transpilation isn't a tool chain. It's just one link. It's not a big deal and doesn't even require changing an existing project's structure.
2) TypeScript doesn't require changing your code at all. This library does.
3) TypeScript is zero extra lines of code in production.
When I do that I find I perform better, feel more confident, have more creativity, and am more engaged in my work. Feeling unique and being authentic in work is important to me.
Writing my own stuff like this is one things that feels non conformist to me. It’s motivating.
As for your personal preference to be unique and non-conformist, I can't argue with that because it's a personal preference.
I will, however, push back a little bit on the idea that reinventing a wheel and being non-conformist results in good code. If you're fixing legitimate deficiencies in existing solutions, great! Otherwise you're just writing code that's harder to understand, harder to maintain, and likely buggier. And that's the best-case scenario.
In some cases, you'll be reinventing a wheel, but you'll be doing it worse because you're missing the cumulative hundreds of years of programming experience that go into a great FOSS alternative.
So for code that'll never be touched by another person and can tolerate bugs, great! Don't conform. But that's a very, very narrow category of code.
My one abstracts all type related code into some functions so you can apply it when you want, rather than it happening automatically. I think I like this better because it's more clear when type will be applied. Also I prefer my syntax, but 'tcomb' syntax is an achievement and also concise.