Skip to content

Commit

Permalink
fix: Certain comments cause generator exceptions (#14810)
Browse files Browse the repository at this point in the history
* fix

* improve
  • Loading branch information
liuxingbaoyu committed Aug 4, 2022
1 parent 9fad3a8 commit bee081d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/babel-generator/src/printer.ts
Expand Up @@ -805,6 +805,8 @@ class Printer {
} else if (!this._noLineTerminator) {
val = `//${comment.value}\n`;
maybeNewline = true;
} else {
val = `/*${comment.value}*/`;
}

// Avoid creating //* comments
Expand Down
@@ -0,0 +1,10 @@
const test = (): {
// test
foo: string;
} => {
return {
foo: "bar"
};
};

export default test;
@@ -0,0 +1 @@
{ "plugins": ["typescript"] }
@@ -0,0 +1,10 @@
const test = (): {
// test
foo: string;
} => {
return {
foo: "bar"
};
};

export default test;

0 comments on commit bee081d

Please sign in to comment.