-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
function f<T>(x: T) {
x = {};
}
Current
Type '{}' is not assignable to type 'T'.
'{}' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
Type '10' is not assignable to type 'T'.
'10' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint '{}'.
Nobody ever mentioned a constraint or {}
in this code, so why is it being displayed? As a user, this is telling me more than I needed or wanted to know.
Proposed
Type '{}' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to '{}'.
Type '10' is not assignable to type 'T'.
'T' could be instantiated with an arbitrary type which could be unrelated to '10'.
AnyhowStep, panzerdp, fvilante, original001 and bl-ue
Metadata
Metadata
Assignees
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript