-
Notifications
You must be signed in to change notification settings - Fork 425
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
TimerHandler should not be an alias for string | Function
#559
Comments
This is actually coming from the webidl, so there is not a simple way to remove these. do you want |
//CC @saschanaz So the proposal is to flatten unions of primitives when we are emitting them.. so |
So TS now automatically converts unions into typedefs? Interesting. |
@saschanaz only for display purposes We might be able to do a sneaky workaround like |
IMO one of the core issues is the automatic union-typedef conversion for display purposes:
Edit: Anyway I'm not a fan for those mini-typedefs as I think they are for spec authors rather than devs. If we remove them, will we also remove non-union typedefs e.g. |
@saschanaz A few replies:
|
@sandersn Oops, sorry for replying too late.
Users may confused because the compiler is using the names the user didn't write, so they may want to find where the name is from, by goto-def, Control+F, or anything. I think the message itself is confusing here. Can we do something like: Error: Argument of type "null" is not assignable to parameter of union type "string | Function" (aliased as "TimerHandler") This way unions won't confuse users too much. Edit: I just posted a comment and it unassigned a member 😮 |
Is this still the case? I can't reproduce this in TS3.3. |
Possibly off-topic: any plans to only allow |
Because of global type alias interning, the global
type TimerHandler = string | Function
means anystring | Function
union gets calledTimerHandler
. This makes (for example) lodash errors and quick info even more confusing.Edit: here is an example of the confusing error:
Argument of type "null" is not assignable to parameter of type 'TimerHandler'.
The text was updated successfully, but these errors were encountered: