jmurphyau / ember-truth-helpers

Ember HTMLBars Helpers for {{if}} & {{unless}}: not, and, or, eq & is-array
MIT License
706 stars 95 forks source link

Failing test for and / or types #193

Closed Techn1x closed 1 year ago

Techn1x commented 1 year ago

Just wanted to create this failing types test, as the v4 release didn't quite nail the and / or helper types

This might be partially resolved by https://github.com/jmurphyau/ember-truth-helpers/pull/191 ? But I am not sure.

We probably want some return types like this (examples adapted from this example https://github.com/microsoft/TypeScript/issues/31579 )

type Or<A extends boolean, B extends boolean> = A extends true
    ? A // A was truthy, returns itself
    : B extends true
        ? B // B was truthy, returns itself
        : B // last item in logical OR returns itself even if falsey
// for multiple args
type Or3<A extends boolean, B extends boolean, C extends boolean> = Or<A, Or<B, C>>
Techn1x commented 1 year ago

This PR can be used or closed, I don't mind.

SergeAstapov commented 1 year ago

this is fixed in #196/#199