@@ -2287,7 +2287,7 @@ namespace ts {
2287
2287
interface NodeBuilderContext {
2288
2288
readonly enclosingDeclaration: Node | undefined;
2289
2289
readonly flags: NodeBuilderFlags | undefined;
2290
-
2290
+
2291
2291
// State
2292
2292
encounteredError: boolean;
2293
2293
inObjectTypeLiteral: boolean;
@@ -2564,7 +2564,6 @@ namespace ts {
2564
2564
return createTypeLiteralNode(members);
2565
2565
}
2566
2566
2567
-
2568
2567
function shouldAddParenthesisAroundFunctionType(callSignature: Signature, context: NodeBuilderContext) {
2569
2568
if (InElementType) {
2570
2569
return true;
@@ -2670,13 +2669,10 @@ namespace ts {
2670
2669
return typeElements;
2671
2670
}
2672
2671
2672
+ // TODO: make logic mirror that of writeObjectLiteralType
2673
2673
for (const propertySymbol of properties) {
2674
2674
const propertyType = getTypeOfSymbol(propertySymbol);
2675
- const oldDeclaration = propertySymbol.declarations && propertySymbol.declarations[0] as TypeElement;
2676
- if (!oldDeclaration) {
2677
- return;
2678
- }
2679
- const propertyName = getDeepSynthesizedClone(oldDeclaration.name);
2675
+ const propertyName = symbolToName(propertySymbol, /*expectsIdentifier*/ true, context);
2680
2676
const optionalToken = propertySymbol.flags & SymbolFlags.Optional ? createToken(SyntaxKind.QuestionToken) : undefined;
2681
2677
if (propertySymbol.flags & (SymbolFlags.Function | SymbolFlags.Method) && !getPropertiesOfObjectType(propertyType).length) {
2682
2678
const signatures = getSignaturesOfType(propertyType, SignatureKind.Call);
@@ -2697,7 +2693,7 @@ namespace ts {
2697
2693
propertyName,
2698
2694
optionalToken,
2699
2695
propertyTypeNode,
2700
- /*initializer*/undefined);
2696
+ /*initializer*/ undefined);
2701
2697
typeElements.push(propertySignature);
2702
2698
}
2703
2699
}
@@ -2744,8 +2740,8 @@ namespace ts {
2744
2740
const returnType = getReturnTypeOfSignature(signature);
2745
2741
returnTypeNode = returnType && typeToTypeNodeHelper(returnType, context);
2746
2742
}
2747
- if(context.flags & NodeBuilderFlags.SuppressAnyReturnType) {
2748
- if(returnTypeNode && returnTypeNode.kind === SyntaxKind.AnyKeyword) {
2743
+ if (context.flags & NodeBuilderFlags.SuppressAnyReturnType) {
2744
+ if (returnTypeNode && returnTypeNode.kind === SyntaxKind.AnyKeyword) {
2749
2745
returnTypeNode = undefined;
2750
2746
}
2751
2747
}
0 commit comments