Skip to content

Commit 7f66370

Browse files
committed
Fix check in hasNonBindingPatternContextualTypeWithNoGenericTypes
1 parent 365b256 commit 7f66370

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24242,17 +24242,13 @@ namespace ts {
2424224242
return !!(type.flags & TypeFlags.Instantiable && !maybeTypeOfKind(getBaseConstraintOrType(type), TypeFlags.Nullable));
2424324243
}
2424424244

24245-
function containsGenericType(type: Type): boolean {
24246-
return !!(type.flags & TypeFlags.Instantiable || type.flags & TypeFlags.UnionOrIntersection && some((type as UnionOrIntersectionType).types, containsGenericType));
24247-
}
24248-
2424924245
function hasNonBindingPatternContextualTypeWithNoGenericTypes(node: Node) {
2425024246
// Computing the contextual type for a child of a JSX element involves resolving the type of the
2425124247
// element's tag name, so we exclude that here to avoid circularities.
2425224248
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) &&
2425324249
!((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
2425424250
getContextualType(node, ContextFlags.SkipBindingPatterns);
24255-
return contextualType && !someType(contextualType, containsGenericType);
24251+
return contextualType && !(isGenericObjectType(contextualType) || isGenericIndexType(contextualType));
2425624252
}
2425724253

2425824254
function getNarrowableTypeForReference(type: Type, reference: Node, checkMode?: CheckMode) {

0 commit comments

Comments
 (0)