mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Display write type for property accesses in write locations (#54777)
This commit is contained in:
@@ -11541,7 +11541,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) :
|
||||
// NOTE: cast to TransientSymbol should be safe because only TransientSymbols can have CheckFlags.SyntheticProperty
|
||||
(symbol as TransientSymbol).links.writeType || (symbol as TransientSymbol).links.type! :
|
||||
getTypeOfSymbol(symbol);
|
||||
removeMissingType(getTypeOfSymbol(symbol), !!(symbol.flags & SymbolFlags.Optional));
|
||||
}
|
||||
if (symbol.flags & SymbolFlags.Accessor) {
|
||||
return checkFlags & CheckFlags.Instantiated ?
|
||||
@@ -27703,7 +27703,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
location = location.parent;
|
||||
}
|
||||
if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
|
||||
const type = removeOptionalTypeMarker(getTypeOfExpression(location as Expression));
|
||||
const type = removeOptionalTypeMarker(
|
||||
isWriteAccess(location) && location.kind === SyntaxKind.PropertyAccessExpression ?
|
||||
checkPropertyAccessExpression(location as PropertyAccessExpression, /*checkMode*/ undefined, /*writeOnly*/ true) :
|
||||
getTypeOfExpression(location as Expression)
|
||||
);
|
||||
if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
|
||||
return type;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user