Skip to content

Commit

Permalink
Infer type from assertion for export assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
dragomirtitian committed Mar 5, 2024
1 parent 3833bf5 commit 4ffc67a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/compiler/transformers/declarations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,8 @@ export function transformDeclarations(context: TransformationContext) {
errorNode: input,
});
errorFallbackNode = input;
const varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
const type = ensureType(input);
const varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, type, /*initializer*/ undefined);
errorFallbackNode = undefined;
const statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(SyntaxKind.DeclareKeyword)] : [], factory.createVariableDeclarationList([varDecl], NodeFlags.Const));

Expand Down

0 comments on commit 4ffc67a

Please sign in to comment.