jmurphyau / ember-truth-helpers

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

Document usage with glint additionalSpecialForms config #204

Open bwbuchanan opened 9 months ago

bwbuchanan commented 9 months ago

glint requires some additional hints to correctly handle discriminated unions when using ember-truth-helpers.

See:

Note that for the ember-template-imports case in the example configs given above, an additional entry for the new named exports should be added, so it should look something like this in tsconfig.json:

"glint": {
  "environment": {
    "ember-loose": {
      "additionalSpecialForms": {
        "globals": {
          "eq": "===",
          "not-eq": "!==",
          "and": "&&",
          "or": "||",
          "not": "!"
        }
      }
    },
    "ember-template-imports": {
      "additionalSpecialForms": {
        "imports": {
          "ember-truth-helpers/helpers/eq": { "default": "===" },
          "ember-truth-helpers/helpers/not-eq": { "default": "!==" },
          "ember-truth-helpers/helpers/and": { "default": "&&" },
          "ember-truth-helpers/helpers/or": { "default": "||" },
          "ember-truth-helpers/helpers/not": { "default": "!" }
          "ember-truth-helpers": {
            "eq": "===",
            "notEq": "!==",
            "and": "&&",
            "or": "||",
            "not": "!"
          }
        }
      }
    }
  }
}
SergeAstapov commented 9 months ago

@bwbuchanan would you to open PR to propose those changes in readme?