@@ -12869,8 +12869,9 @@ namespace ts {
12869
12869
12870
12870
/** We approximate own properties as non-methods plus methods that are inside the object literal */
12871
12871
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)));
12874
12875
}
12875
12876
12876
12877
function getSpreadSymbol(prop: Symbol, readonly: boolean) {
@@ -20385,26 +20386,7 @@ namespace ts {
20385
20386
}
20386
20387
}
20387
20388
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));
20408
20390
// Return the declared type to reduce follow-on errors
20409
20391
return type;
20410
20392
}
0 commit comments