-
I'm trying to introduce Glint to our codebase. We use interface Args {
onArg1?: () => unknown;
onArg2?: () => unknown;
} With that, I'm seeing an error like: Nesting the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Unfortunately there's no way within TypeScript's type system to express how As of #510, we now support special forms for logical operators like
In the meantime, though, it's possible to opt in to treating "glint": {
"environment": {
"ember-loose": {
"additionalSpecialForms": {
"globals": {
"and": "&&",
"or": "||",
"not": "!"
}
}
},
"ember-template-imports": {
"additionalSpecialForms": {
"imports": {
"ember-truth-helpers/helpers/and": { "default": "&&" },
"ember-truth-helpers/helpers/or": { "default": "||" },
"ember-truth-helpers/helpers/not": { "default": "!" }
}
}
}
}
} We currently don't cover this in our formal documentation anywhere since the semantics of RFC 562 are still in flux, but those options are pretty stable at this point, and it might make sense for us to document them under "Advanced Configuration" or something. In the meantime we can at least point folks to this discussion thread when the question comes up 🙂 |
Beta Was this translation helpful? Give feedback.
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:{{and}}
helper actually behaves like JS&&