Skip to content

Commit c8cca30

Browse files
Reverted emit to original in error case.
1 parent adf815d commit c8cca30

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

src/compiler/checker.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6742,9 +6742,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
67426742
function createAnonymousTypeNode(type: ObjectType): TypeNode {
67436743
const typeId = type.id;
67446744
const symbol = type.symbol;
6745-
// if (checkTruncationLength(context)) {
6746-
// return createElidedInformationPlaceholder(context);
6747-
// }
67486745
if (symbol) {
67496746
const isInstantiationExpressionType = !!(getObjectFlags(type) & ObjectFlags.InstantiationExpressionType);
67506747
if (isInstantiationExpressionType) {

src/compiler/expressionToTypeNode.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ export function createSyntacticTypeNodeBuilder(
772772
if (declaredType) {
773773
resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context, node, symbol));
774774
}
775-
else if (node.initializer) {
775+
else if (node.initializer && symbol.declarations?.length === 1) {
776776
if (!resolver.isExpandoFunctionDeclaration(node) && !isContextuallyTyped(node)) {
777777
resultType = typeFromExpression(node.initializer, context, /*isConstContext*/ undefined, /*requiresAddingUndefined*/ undefined, isVarConstLike(node));
778778
}

tests/baselines/reference/jsFileCompilationDuplicateVariableErrorReported.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ var x = 10; // Error reported
1414

1515
//// [out.d.ts]
1616
declare var x: string;
17-
declare var x: number;
17+
declare var x: string;

0 commit comments

Comments
 (0)