@@ -12869,8 +12869,9 @@ namespace ts {
1286912869
1287012870 /** We approximate own properties as non-methods plus methods that are inside the object literal */
1287112871 function isSpreadableProperty(prop: Symbol): boolean {
12872- return !(prop.flags & (SymbolFlags.Method | SymbolFlags.GetAccessor | SymbolFlags.SetAccessor)) ||
12873- !prop.declarations.some(decl => isClassLike(decl.parent));
12872+ return !some(prop.declarations, isPrivateIdentifierPropertyDeclaration) &&
12873+ (!(prop.flags & (SymbolFlags.Method | SymbolFlags.GetAccessor | SymbolFlags.SetAccessor)) ||
12874+ !prop.declarations.some(decl => isClassLike(decl.parent)));
1287412875 }
1287512876
1287612877 function getSpreadSymbol(prop: Symbol, readonly: boolean) {
@@ -20385,26 +20386,7 @@ namespace ts {
2038520386 }
2038620387 }
2038720388 else if (!assumeInitialized && !(getFalsyFlags(type) & TypeFlags.Undefined) && getFalsyFlags(flowType) & TypeFlags.Undefined) {
20388- const diag = error(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
20389-
20390- // See GH:32846 - if the user is using a variable whose type is () => T1 | ... | undefined
20391- // they may have meant to specify the type as (() => T1 | ...) | undefined
20392- // This is assumed if: the type is a FunctionType, the return type is a Union, the last constituent of
20393- // the union is `undefined`
20394- if (type.symbol && type.symbol.declarations.length === 1 && isFunctionTypeNode(type.symbol.declarations[0])) {
20395- const funcTypeNode = <FunctionTypeNode>type.symbol.declarations[0];
20396- const returnType = getReturnTypeFromAnnotation(funcTypeNode);
20397- if (returnType && returnType.flags & TypeFlags.Union) {
20398- const unionTypes = (<UnionTypeNode>funcTypeNode.type).types;
20399- if (unionTypes && unionTypes[unionTypes.length - 1].kind === SyntaxKind.UndefinedKeyword) {
20400- const parenedFuncType = getMutableClone(funcTypeNode);
20401- // Highlight to the end of the second to last constituent of the union
20402- parenedFuncType.end = unionTypes[unionTypes.length - 2].end;
20403- addRelatedInfo(diag, createDiagnosticForNode(parenedFuncType, Diagnostics.Did_you_mean_to_parenthesize_this_function_type));
20404- }
20405- }
20406- }
20407-
20389+ error(node, Diagnostics.Variable_0_is_used_before_being_assigned, symbolToString(symbol));
2040820390 // Return the declared type to reduce follow-on errors
2040920391 return type;
2041020392 }
0 commit comments