mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Revert "Stop looking at binding patterns for type argument inference" (#46013)
* Revert "Stop looking at binding patterns for type argument inference (#45719)"
This reverts commit be618b1446.
* Update error baseline for moved lib file declaration
This commit is contained in:
@@ -25445,8 +25445,7 @@ namespace ts {
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
if (!(contextFlags! & ContextFlags.SkipBindingPatterns) && isBindingPattern(declaration.name)) {
|
||||
// This is less a contextual type and more an implied shape - in some cases, this may be undesirable
|
||||
if (!(contextFlags! & ContextFlags.SkipBindingPatterns) && isBindingPattern(declaration.name)) { // This is less a contextual type and more an implied shape - in some cases, this may be undesirable
|
||||
return getTypeFromBindingPattern(declaration.name, /*includePatternInType*/ true, /*reportErrors*/ false);
|
||||
}
|
||||
}
|
||||
@@ -28753,7 +28752,7 @@ namespace ts {
|
||||
// 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the
|
||||
// return type of 'wrap'.
|
||||
if (node.kind !== SyntaxKind.Decorator) {
|
||||
const contextualType = getContextualType(node, ContextFlags.SkipBindingPatterns);
|
||||
const contextualType = getContextualType(node, every(signature.typeParameters, p => !!getDefaultFromTypeParameter(p)) ? ContextFlags.SkipBindingPatterns : ContextFlags.None);
|
||||
if (contextualType) {
|
||||
// We clone the inference context to avoid disturbing a resolution in progress for an
|
||||
// outer call expression. Effectively we just want a snapshot of whatever has been
|
||||
|
||||
Reference in New Issue
Block a user