12 comments

[ 24.8 ms ] story [ 593 ms ] thread
From the FAQ about why you wouldn't just use TypeScript:

> 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.

I think one other main reason for myself is I feel happier being non conformist, and sometimes writing my own from scratch code rather than using a popular library.

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.

Let me first say that I like the approach you took in this library, and it's surprisingly clean in terms of syntax.

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.

(comment deleted)
Intriguing theory. It's unrelated to how I think about it. Interesting to know you think that way, tho.
(comment deleted)
(comment deleted)
(comment deleted)
Don’t pretend someone can’t create something better than what exists, just because you need to feel better about stopping yourself.
(comment deleted)
How does this differ from something like https://github.com/gcanti/tcomb ?
Hard to say after a quick look at an early stage, but I think `tcomb` is comprehensive (it even has a typed JSON format, I think), and focuses on letting you define models, with getters / setters that are type checked.

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.