-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Inferred never
values don't properly type guard
#60185
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
Comments
as per #32695 :
Your |
Yes, I realize the why, but there is no way whatsoever to tell what a function is going to do in this case without literally looking at the source of it. TS shows that both are |
I'd argue that this behavior is wrong, but alternatively tooling should be able to tell the difference. As far as I can tell, TS doesn't actually expose the difference. |
The behavior is intentional, not wrong, and was done for performance reasons. But it would probably be good to add this to the FAQ. And to the handbook, which is covered by #59930. |
Oh ffs, I'm done reporting issues to you guys. You make stupid ass decisions and then try to justify them. It's utterly pathetic. |
Neither me nor Andarist are part of the TypeScript team. But you can be assured that the team does not make these decisions willy-nilly or out of spite, there's reasons behind them. They're not "stupid ass decisions", they're technical decisions with benefits and drawbacks. And you're advised to check out the Code of Conduct. :-) |
Oh nooo, you're offended. Like I give a single fuck |
π Search Terms
never type guard
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?noUncheckedIndexedAccess=true&moduleResolution=99&target=99&module=199&exactOptionalPropertyTypes=true&ts=5.6.3#code/GYVwdgxgLglg9mABAExgUwBQEoBcixoBuaATogN4BQiNiJaUIJSYIANm4gIYDO+RpANyUAvpUqhIsBIhhhgpACLpsFarXqNmKFVmFjKyNBDZd6iCAh5READzzWScgOaIAPvnZthlGMEQYAIS2WGq0svJKuvritoKIAPQJdrJ81jAciAAOcDw8MABGbACenhzifgHBoVThqJh6orHxSSlgcADuFlxgAOQ2BWhlbEA
π» Code
π Actual behavior
Two functions that have "identical" signatures,
() => never
, are not acting the sameπ Expected behavior
I'd expect both of these to act the same way since, for everything I can see, TS sees their signatures as being identical.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: