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
Type 'this' is not assignable to type 'A<unknown>'.
Type 'A<T>' is not assignable to type 'A<unknown>'.
Type 'unknown' is not assignable to type 'T'. // <-----
'T' could be instantiated with an arbitrary type which could be unrelated to 'unknown'.
π Actual behavior
Judging from the error message, could it be that the comparison was written in reverse?
π Expected behavior
Any value can be assigned to unknown.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
This error is correct. Say you have an A<number>. It must be the case that you can only pass numbers into its func. But if you assign an A<number> to A<unknown>, now func can accept unknown, which is anything, which violates what func of A<number> expects.
π Search Terms
generic
method
π Version & Regression Information
v5.4.4
β― Playground Link
https://www.typescriptlang.org/play?#code/MYGwhgzhAECCA8AVAfNA3gWAFDV9AJgKahgBOh0AZgK4B2wAXNABQBuYI1hTiAlNAF5UrAPYBLfAG5seaMA4hm-TDll5gI2hAAu0MEwR0A1rREB3WqgHRtACzERpq3AF9sbrEA
π» Code
π Actual behavior
Judging from the error message, could it be that the comparison was written in reverse?
π Expected behavior
Any value can be assigned to unknown.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: