Tom Crockett

Results 56 comments of Tom Crockett

If I understand correctly, you just want to extract an array of the literal values? ```ts const stateLiterals = State.alternatives.map(literal => literal.value) // stateLiterals: ("Unknown" | "Online" | "Offline")[] ```

> Yea, I already figured that out, but it feels kinda dirty to repeat this all over the place (and abusing some internals) :) It's not an abuse of internals,...

This seems maybe useful enough to add to a utilities module.

@thorning yeah, I agree, it's probably useful enough to add to the core library. Or, following `mobx-state-tree`'s example, it could be called `Enumeration`. I'd definitely entertain a PR if you'd...

Sounds interesting, feel free to make a PR.

`Intersect()` should equal `Unknown`, right?

Yep, it definitely should. Interested in making a PR?

It would be a departure from the invariant so far that runtypes never produce new values, they just validate existing ones. That said, I can't think of any specific reason...

I'd be open to generating an ES target as well, how would you propose doing it? Publishing a separate `runtypes-es` package to NPM a la `lodash-es`?