Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect glint return type for or helper in 4.0.0-beta.0 #187

Closed
Techn1x opened this issue Aug 28, 2023 · 2 comments · Fixed by #188
Closed

Incorrect glint return type for or helper in 4.0.0-beta.0 #187

Techn1x opened this issue Aug 28, 2023 · 2 comments · Fixed by #188
Labels

Comments

@Techn1x
Copy link
Contributor

Techn1x commented Aug 28, 2023

Thanks for cutting a release with the glint types.

I updated my application to use the 4.0.0-beta.0 and its glint types, switching away from the types provided by the gavant package https://github.com/Gavant/glint-template-types/tree/main/types/ember-truth-helpers

This has brought up some issues with the return value of the or helper not being correct. The values that the or helper in this addon returns is always one of the args it was given, as if it were a javascript argA || argB. However, it is typed to return strictly boolean, which is not representative of what is actually returned by the helper.

The gavant package types dealt with this in the following way
https://github.com/Gavant/glint-template-types/blob/cd9efb6617d93c28d93800270e3af1963fd792c6/types/ember-truth-helpers/or.d.ts#L21

Return: OrPair<OrPair<OrPair<OrPair<A, B>, C>, D>, E>;

There's some extra details on the behaviour of the or helper in this issue comment
#150 (comment)

@SergeAstapov
Copy link
Collaborator

@Techn1x thanks for reporting this. It's a known issue and the only reason why we didn't cut v4 and went with beta instead as described in https://github.com/jmurphyau/ember-truth-helpers/releases/tag/v4.0.0-beta.0

We are working on fixing this in #185 and #188.

@Techn1x
Copy link
Contributor Author

Techn1x commented Aug 29, 2023

Ah! Thanks. I did not realise it was known / being worked on. Hopefully this issue shows that to others while we work on it so they don't open issues as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants