Skip to content

Commit

Permalink
fix: throw descriptive error when inserting variable statement with n…
Browse files Browse the repository at this point in the history
…o declarations (#1598)
  • Loading branch information
dsherret authored Dec 30, 2024
1 parent 84613e5 commit f4ed887
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export class VariableStatementStructurePrinter extends NodePrinter<OptionalKind<
writer.hangingIndent(() => {
this.factory.forModifierableNode().printText(writer, structure);
writer.write(`${structure.declarationKind || VariableDeclarationKind.Let} `);
if (structure.declarations.length === 0)
throw new Error("You must provide at least one declaration when inserting a variable statement.");
this.factory.forVariableDeclaration().printTexts(writer, structure.declarations);
writer.write(";");
});
Expand Down

0 comments on commit f4ed887

Please sign in to comment.