-
Notifications
You must be signed in to change notification settings - Fork 95
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
Failing test for and / or types #193
Conversation
<AndOrTypeChecking | ||
@andArg={{or (hash) (array)}} | ||
@orArg={{and (hash) (array)}} | ||
@andArg={{and (hash) (array)}} | ||
@orArg={{or (hash) (array)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed like these args were using the wrong helpers ? maybe?
{{!-- and returns the last truthy item --}} | ||
@andFallbackArg={{and true "string"}} | ||
{{!-- or returns the first truthy item --}} | ||
@orFallbackArg={{or undefined "string"}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these args only accept strings.
But the types errors indicate that the and/or helpers are trying to provide them
boolean | string
undefined | string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might seem that these are pedantic or not realistic, but I'm trying to cover a scenario like;
teacherId: string | undefined // may or may not be set
AllTeachersOptionId: "all-teachers" // always set
template
@teacherId={{or this.teacherId AllTeachersOptionId}}
This PR can be used or closed, I don't mind. |
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 #191 ? But I am not sure.
We probably want some return types like this (examples adapted from this example microsoft/TypeScript#31579 )