Skip to content

Typing an and helper #547

Answered by dfreeman
swastik asked this question in Q&A
Mar 24, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Unfortunately there's no way within TypeScript's type system to express how && works; the logical and comparison operators' behaviors are all essentially "baked in" to the language. Similarly, within Glint we have a notion of special forms to give special meaning to things like {{if}} and {{yield}} outside of what would normally be expressible with helper types.

As of #510, we now support special forms for logical operators like &&, but they aren't actually enabled for any helpers out of the box, for two reasons:

  • Until RFC 562 lands, we have no way of knowing that an arbitrary global {{and}} helper actually behaves like JS &&
  • As currently specified by RFC 562, the notion of "truthiness" …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@swastik
Comment options

Answer selected by swastik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants