mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-31 08:07:10 -05:00
@@ -45149,6 +45149,20 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isThisPropertyAndThisTyped(node: PropertyAccessExpression) {
|
||||
if (node.expression.kind === SyntaxKind.ThisKeyword) {
|
||||
const container = getThisContainer(node, /*includeArrowFunctions*/ false, /*includeClassComputedPropertyName*/ false);
|
||||
if (isFunctionLike(container)) {
|
||||
const containingLiteral = getContainingObjectLiteral(container);
|
||||
if (containingLiteral) {
|
||||
const contextualType = getApparentTypeOfContextualType(containingLiteral, /*contextFlags*/ undefined);
|
||||
const type = contextualType && getThisTypeFromContextualType(contextualType);
|
||||
return type && !isTypeAny(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSymbolOfNameOrPropertyAccessExpression(name: EntityName | PrivateIdentifier | PropertyAccessExpression | JSDocMemberName): Symbol | undefined {
|
||||
if (isDeclarationName(name)) {
|
||||
return getSymbolOfNode(name.parent);
|
||||
@@ -45158,7 +45172,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
name.parent.kind === SyntaxKind.PropertyAccessExpression &&
|
||||
name.parent === (name.parent.parent as BinaryExpression).left) {
|
||||
// Check if this is a special property assignment
|
||||
if (!isPrivateIdentifier(name) && !isJSDocMemberName(name)) {
|
||||
if (!isPrivateIdentifier(name) && !isJSDocMemberName(name) && !isThisPropertyAndThisTyped(name.parent as PropertyAccessExpression)) {
|
||||
const specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(name);
|
||||
if (specialPropertyAssignmentSymbol) {
|
||||
return specialPropertyAssignmentSymbol;
|
||||
|
||||
Reference in New Issue
Block a user