Generic is "any
-like" for relational operators
#58938
Labels
Duplicate
An existing issue was already created
🔎 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: