Tom Crockett
Tom Crockett
I don't really have the spare cycles to work on this personally but you're welcome to open a PR 🙂 This blog post might be a good starting point: https://2ality.com/2019/10/hybrid-npm-packages.html
Can you be more specific about what you're proposing, maybe with some example code? It's not clear to me what you mean by sanitization in this context.
That makes sense. I think it should be possible to write such a function against runtype's `Reflect` API. If so, I would say that it makes sense to define it...
>```ts >const DescriptionOfOne = One.pipe(x=>x.descOfOne); >//not Runtype anymore, can be used only for pattern matching > >// OneOrTwo | null -> string >const getDescription = matchCase() > .of(DescriptionOfOne, desc =>...
> Also with typescript 2.8 we will have a proper Diff. And if I understand it correctly it opens this > ```typescript > const EmptyOne = One.withConstraint( one => one.descOfOne.length...
I could see `Diff` being useful in refining the types of the case payloads, e.g. ```ts const HasX = Record({ x: number }) const HasXY = Record({ x: number; y:...
I'm still not quite sure what you mean by "ad-hoc" or "inline" in this context, but some of your examples make me think that you might find my [`unionize`](https://github.com/pelotom/unionize) library...
Ok, so porting the example to `runtypes`, ```ts import { Union, Record, Literal, Number, String, Static } from 'runtypes'; const Props = Union( Record({ tag: Literal('loading'), progress: Number }), Record({...
> 1) value being checked comes at the last line (...)(props). As opposed to swift, F#, js switch, resonML etc. It breaks my mental model at least. Ok, for this...
> I'm all in for curried version. It is the flow of reading that throws me off (order of args). However changing the args order would defeat currying in the...