Fixed a crash when inferring return type of an accessor with errors in its return statement (#56258)

This commit is contained in:
Mateusz Burzyński
2023-11-15 17:39:58 -08:00
committed by GitHub
parent d33917fb02
commit 32b618c2d8
6 changed files with 98 additions and 1 deletions
+1 -1
View File
@@ -7315,7 +7315,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (propertySymbol.flags & SymbolFlags.Accessor) {
const writeType = getWriteTypeOfSymbol(propertySymbol);
if (propertyType !== writeType) {
if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
const getterDeclaration = getDeclarationOfKind<GetAccessorDeclaration>(propertySymbol, SyntaxKind.GetAccessor)!;
const getterSignature = getSignatureFromDeclaration(getterDeclaration);
typeElements.push(