@@ -834,14 +834,15 @@ export function createSyntacticTypeNodeBuilder(
834834 symbol : Symbol | undefined ,
835835 context : SyntacticTypeNodeBuilderContext ,
836836 reportFallback = true ,
837+ widen = false ,
837838 ) {
838839 if ( reportFallback ) {
839840 context . tracker . reportInferenceFallback ( node ) ;
840841 }
841842 if ( context . noInferenceFallback === true ) {
842843 return factory . createKeywordTypeNode ( SyntaxKind . AnyKeyword ) ;
843844 }
844- return resolver . serializeTypeOfDeclaration ( context , node , symbol ) ;
845+ return resolver . serializeTypeOfDeclaration ( context , node , symbol , widen ) ;
845846 }
846847
847848 function inferExpressionType ( node : Expression , context : SyntacticTypeNodeBuilderContext , reportFallback = true , requiresAddingUndefined ?: boolean ) {
@@ -1058,9 +1059,6 @@ export function createSyntacticTypeNodeBuilder(
10581059 }
10591060 return syntacticResult ( inferExpressionType ( objectLiteral , context , /*reportFallback*/ false , requiresAddingUndefined ) ) ;
10601061 }
1061- // Disable any inference fallback since we won't actually use the resulting type and we don't want to generate errors
1062- const oldNoInferenceFallback = context . noInferenceFallback ;
1063- context . noInferenceFallback = true ;
10641062 const properties : TypeElement [ ] = [ ] ;
10651063 const oldFlags = context . flags ;
10661064 context . flags |= NodeBuilderFlags . InObjectTypeLiteral ;
@@ -1092,16 +1090,15 @@ export function createSyntacticTypeNodeBuilder(
10921090 if ( ! ( context . flags & NodeBuilderFlags . MultilineObjectLiterals ) ) {
10931091 setEmitFlags ( typeNode , EmitFlags . SingleLine ) ;
10941092 }
1095- context . noInferenceFallback = oldNoInferenceFallback ;
1096- return notImplemented ;
1093+ return syntacticResult ( addUndefinedIfNeeded ( typeNode , requiresAddingUndefined , objectLiteral , context ) ) ;
10971094 }
10981095
10991096 function typeFromObjectLiteralPropertyAssignment ( prop : PropertyAssignment , name : PropertyName , context : SyntacticTypeNodeBuilderContext , isConstContext : boolean ) {
11001097 const modifiers = isConstContext ?
11011098 [ factory . createModifier ( SyntaxKind . ReadonlyKeyword ) ] :
11021099 [ ] ;
11031100 const expressionResult = typeFromExpression ( prop . initializer , context , isConstContext ) ;
1104- const typeNode = expressionResult . type !== undefined ? expressionResult . type : inferTypeOfDeclaration ( prop , /*symbol*/ undefined , context , expressionResult . reportFallback ) ;
1101+ const typeNode = expressionResult . type !== undefined ? expressionResult . type : inferTypeOfDeclaration ( prop , /*symbol*/ undefined , context , expressionResult . reportFallback , ! isConstContext ) ;
11051102
11061103 return factory . createPropertySignature (
11071104 modifiers ,
0 commit comments