mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
narrow type for generic variables inside TypeQuery (#48434)
This commit is contained in:
1 parent
25aecd4c3e
commit
370d34cdca
6 files changed
+222
No files matched your search
@@ -25311,6 +25311,7 @@ namespace ts {
|
||||
// a generic type without a nullable constraint and x is a generic type. This is because when both obj
|
||||
// and x are of generic types T and K, we want the resulting type to be T[K].
|
||||
return parent.kind === SyntaxKind.PropertyAccessExpression ||
|
||||
parent.kind === SyntaxKind.QualifiedName ||
|
||||
parent.kind === SyntaxKind.CallExpression && (parent as CallExpression).expression === node ||
|
||||
parent.kind === SyntaxKind.ElementAccessExpression && (parent as ElementAccessExpression).expression === node &&
|
||||
!(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression((parent as ElementAccessExpression).argumentExpression)));
|
||||
|
||||
Reference in new issue
Block a user