[go: up one dir, main page]

Skip to content

Commit

Permalink
Reverted emit to original in error case.
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomirtitian committed Sep 27, 2024
1 parent adf815d commit 91da5ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 0 additions & 3 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6742,9 +6742,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
function createAnonymousTypeNode(type: ObjectType): TypeNode {
const typeId = type.id;
const symbol = type.symbol;
// if (checkTruncationLength(context)) {
// return createElidedInformationPlaceholder(context);
// }
if (symbol) {
const isInstantiationExpressionType = !!(getObjectFlags(type) & ObjectFlags.InstantiationExpressionType);
if (isInstantiationExpressionType) {
Expand Down
4 changes: 3 additions & 1 deletion src/compiler/expressionToTypeNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
ClassExpression,
CompilerOptions,
ConditionalTypeNode,
countWhere,
Debug,
Declaration,
ElementAccessExpression,
Expand Down Expand Up @@ -99,6 +100,7 @@ import {
isUnionTypeNode,
isValueSignatureDeclaration,
isVarConstLike,
isVariableDeclaration,
JSDocParameterTag,
JSDocPropertyTag,
JSDocSignature,
Expand Down Expand Up @@ -772,7 +774,7 @@ export function createSyntacticTypeNodeBuilder(
if (declaredType) {
resultType = syntacticResult(serializeTypeAnnotationOfDeclaration(declaredType, context, node, symbol));
}
else if (node.initializer) {
else if (node.initializer && (symbol.declarations?.length === 1 || countWhere(symbol.declarations, isVariableDeclaration) === 1)) {
if (!resolver.isExpandoFunctionDeclaration(node) && !isContextuallyTyped(node)) {
resultType = typeFromExpression(node.initializer, context, /*isConstContext*/ undefined, /*requiresAddingUndefined*/ undefined, isVarConstLike(node));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ var x = 10; // Error reported

//// [out.d.ts]
declare var x: string;
declare var x: number;
declare var x: string;

0 comments on commit 91da5ae

Please sign in to comment.