@@ -11940,10 +11940,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1194011940 return containerObjectType;
1194111941 }
1194211942 }
11943- const initType = checkDeclarationInitializer(declaration, checkMode);
11944- const type = widenTypeInferredFromInitializer(declaration, initType);
11945- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
11946- if (isPropertyDeclaration(declaration) && declaration.name && isIdentifier(declaration.name) && declaration.name.text === "D") { console.log("getTypeForVariableLikeDeclaration D: initType=", typeToString(initType), "widenedType=", typeToString(type), "checkMode=", checkMode); }
11943+ const type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration, checkMode));
1194711944 return addOptionality(type, isProperty, isOptional);
1194811945 }
1194911946
@@ -12452,11 +12449,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1245212449 // binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the
1245312450 // tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.
1245412451 function getWidenedTypeForVariableLikeDeclaration(declaration: ParameterDeclaration | PropertyDeclaration | PropertySignature | VariableDeclaration | BindingElement | JSDocPropertyLikeTag, reportErrors?: boolean): Type {
12455- const innerType = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true, CheckMode.Normal);
12456- const result = widenTypeForVariableLikeDeclaration(innerType, declaration, reportErrors);
12457- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12458- if (isPropertyDeclaration(declaration)) { console.log("getWidenedTypeForVariableLikeDeclaration PropertyDecl: declName=", isIdentifier(declaration.name) ? declaration.name.text : "?", "innerType=", innerType ? typeToString(innerType) : "undefined", "result=", typeToString(result)); }
12459- return result;
12452+ return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true, CheckMode.Normal), declaration, reportErrors);
1246012453 }
1246112454
1246212455 function getTypeFromImportAttributes(node: ImportAttributes): Type {
@@ -12553,12 +12546,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1255312546 if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
1255412547 links.type = type;
1255512548 }
12556- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12557- if ((symbol.escapedName as string) === "D" && symbol.valueDeclaration && isPropertyDeclaration(symbol.valueDeclaration)) { console.log("D getTypeOfVar (computed):", typeToString(type), "links.type:", links.type ? typeToString(links.type) : "none", new Error().stack?.split('\n').slice(1,6).join(' | ')); }
1255812549 return type;
1255912550 }
12560- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12561- if ((symbol.escapedName as string) === "D" && symbol.valueDeclaration && isPropertyDeclaration(symbol.valueDeclaration)) { console.log("D getTypeOfVar (cached):", typeToString(links.type), new Error().stack?.split('\n').slice(1,6).join(' | ')); }
1256212551 return links.type;
1256312552 }
1256412553
@@ -12659,8 +12648,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1265912648 || isJSDocPropertyLikeTag(declaration)
1266012649 ) {
1266112650 type = getWidenedTypeForVariableLikeDeclaration(declaration, /*reportErrors*/ true);
12662- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12663- if (isPropertyDeclaration(declaration) && declaration.name && (declaration.name as any).text === "D") { console.log("D property type =", typeToString(type)); }
1266412651 }
1266512652 // getTypeOfSymbol dispatches some JS merges incorrectly because their symbol flags are not mutually exclusive.
1266612653 // Re-dispatch based on valueDeclaration.kind instead.
@@ -12977,8 +12964,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
1297712964 return getTypeOfReverseMappedSymbol(symbol as ReverseMappedSymbol);
1297812965 }
1297912966 if (symbol.flags & (SymbolFlags.Variable | SymbolFlags.Property)) {
12980- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
12981- if ((symbol.escapedName as string) === "D" && symbol.valueDeclaration && isPropertyDeclaration(symbol.valueDeclaration)) { const t = getTypeOfVariableOrParameterOrProperty(symbol); console.log("getTypeOfSymbol D (Variable|Property):", typeToString(t), "checkFlags:", checkFlags); return t; }
1298212967 return getTypeOfVariableOrParameterOrProperty(symbol);
1298312968 }
1298412969 if (symbol.flags & (SymbolFlags.Function | SymbolFlags.Method | SymbolFlags.Class | SymbolFlags.Enum | SymbolFlags.ValueModule)) {
@@ -35013,8 +34998,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3501334998 }
3501434999
3501535000 propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
35016- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
35017- if (isPropertyDeclaration(prop?.valueDeclaration) && isPropertyAccessExpression(node) && node.expression.kind === SyntaxKind.ThisKeyword) { console.log("checkPropAccess: prop=", symbolToString(prop), "propType=", typeToString(propType), "checkFlags=", getCheckFlags(prop)); }
3501835001 }
3501935002
3502035003 return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
@@ -35064,8 +35047,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3506435047 return getFlowTypeOfProperty(node, prop);
3506535048 }
3506635049 propType = getNarrowableTypeForReference(propType, node, checkMode);
35067- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
35068- if (prop && (prop.name as string) === "D") { console.log("getFlowTypeOfAccessExpression: propType =", typeToString(propType)); }
3506935050 // If strict null checks and strict property initialization checks are enabled, if we have
3507035051 // a this.xxx property access, if the property is an instance property without an initializer,
3507135052 // and if we are in a constructor of the same class as the property declaration, assume that
@@ -35091,8 +35072,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3509135072 assumeUninitialized = true;
3509235073 }
3509335074 const flowType = getFlowTypeOfReference(node, propType, assumeUninitialized ? getOptionalType(propType) : propType);
35094- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
35095- if (prop && (prop.name as string) === "D") { console.log("getFlowTypeOfAccessExpression: flowType =", typeToString(flowType)); }
3509635075 if (assumeUninitialized && !containsUndefinedType(propType) && containsUndefinedType(flowType)) {
3509735076 error(errorNode, Diagnostics.Property_0_is_used_before_being_assigned, symbolToString(prop!)); // TODO: GH#18217
3509835077 // Return the declared type to reduce follow-on errors
@@ -41395,8 +41374,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4139541374 const type = getQuickTypeOfExpression(initializer) || (contextualType ?
4139641375 checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || CheckMode.Normal) :
4139741376 checkExpressionCached(initializer, checkMode));
41398- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
41399- if (isPropertyDeclaration(declaration)) { console.log("checkDeclarationInitializer PropertyDecl: checkMode=", checkMode, "initKind=", initializer.kind, "type=", typeToString(type)); }
4140041377 if (isParameter(isBindingElement(declaration) ? walkUpBindingElementsAndPatterns(declaration) : declaration)) {
4140141378 if (declaration.name.kind === SyntaxKind.ObjectBindingPattern && isObjectLiteralType(type)) {
4140241379 return padObjectLiteralType(type as ObjectType, declaration.name);
@@ -46653,8 +46630,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4665346630 let hasDuplicateDefaultClause = false;
4665446631
4665546632 const expressionType = checkExpression(node.expression);
46656- // @ts-ignore DEBUG CODE ONLY, REMOVE ME WHEN DONE
46657- console.log("checkSwitchStatement: expressionType =", typeToString(expressionType), "nodeExprKind=", node.expression.kind, "isPAE=", isPropertyAccessExpression(node.expression));
4665846633
4665946634 forEach(node.caseBlock.clauses, clause => {
4666046635 // Grammar check for duplicate default clauses, skip if we already report duplicate default clause
0 commit comments