Ruslan Fadeev

Results 92 comments of Ruslan Fadeev

Yeah, but that would require 1. output parsed as HTML, which is not always convenient 2. extra code 3. lovebird-specific print code if I don't want tags to show up...

Much better, thanks! You could also save the old `lovebird.print` as `lovebird.printhtml`, this way it's possible to use both HTML and text output.

Next question: how do I get the type of a payload of a variant of a generic union? ```typescript // `Cow` is `{cow: 'cow'}` type Cow = ???; ```

Yeah, I don't know `T`. More accurately, it's defined in another module, and I don't want to depend on it. I was trying to use the new enum type to...

Oh, right. This should work, thanks again :D

Wait, what if it's not a generic type, or a generic type that uses the type argument in a different way?

```typescript const MaybePair = Union(T => ({ None: of(null), Some: of() }) type MaybePair = ... type MaybePairOfThings = MaybePair; type PairOfThings = /* an equivalent of MaybePairOfThings['Some'] */ ```

Oh well. A tangentially related idea: what if there was a `Variant` type, and the `Union` function merely returned a dictionary of functions that returned Variants? Like a structural analogue...

Full disclosure: I've already tried to implement this, but types are hard. Now I'm hoping that someone will solve it before I have to try again out of frustration :P