-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Generic is "any
-like" for relational operators
#58938
Comments
any
-like" for relational operatorsany
-like" for relational operators
Technically both parameters aren't even guaranteed to be the same type, because |
See #52807; this is a rather breaky change to make and we're evaluating what the right course of action is. There are a lot of unconstrained (or insufficiently constrained) type parameters out there |
Should I close this issue (as dupe) and open one about the weird single-sidedness of |
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
🔎 Search Terms
generics templates comparison compare less-than more-than unknown unsound function inline
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?noUncheckedIndexedAccess=true&noUnusedLocals=true&noUnusedParameters=true&target=10&jsx=0&useUnknownInCatchVariables=true&exactOptionalPropertyTypes=true&noFallthroughCasesInSwitch=true&noImplicitOverride=true&noPropertyAccessFromIndexSignature=true&suppressImplicitAnyIndexErrors=true&ts=5.6.0-dev.20240619&noStrictGenericChecks=true#code/MYewdgzgLgBMC2AHGBeGAeAKgGgHwAoAPALhhxgE9TMBKVXGQjSgWACh2wBXAGx+e592CRPkE9sMcTXbsuYACYBTAGYBLMEoXN5y9ZoXCk+Xao1bJp-Vpkc2AZQrwARiB7466GI5duPR0R9XdxpJIL8aWyA
💻 Code
🙁 Actual behavior
Error messages:
The errors show up for both operands of the relational operator except
symbol
s, which only error on LHS.The arrow fn
cmp
doesn't trigger any errors, even at call sites🙂 Expected behavior
cmp
should trigger an error on definition, because even though both params are same-type, they can't always be compared (symbol
s throw at runtime)Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: