You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constequal=<T,>(item: T,partial: Partial<T>)=>{returnitem===partial// no error}
The comparability check is necessarily incomplete (meaning errors more than it "should") to do anything useful; it's true that there's no assertion route from T to P here but that follows from our other rules. I'm not sure there's an improvement to be found here that doesn't make the comparability rule more confusing than it already is
Bug Report
When comparing two variables of generic types, one of which extends the
Partial
of the other, TypeScript complains that the types have no overlap.🔎 Search Terms
TS2367 partial generic
🕗 Version & Regression Information
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
The code above produces this error:
This condition will always return 'false' since the types 'T' and 'P' have no overlap.
🙂 Expected behavior
Since the types
T
andPartial<T>
do overlap, I would expect the above code to compile without errors.The text was updated successfully, but these errors were encountered: