Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3551,6 +3551,7 @@ impl<'a> Gen for TSEnumDeclaration<'a> {

impl<'a> Gen for TSEnumMember<'a> {
fn gen(&self, p: &mut Codegen, ctx: Context) {
p.print_leading_comments(self.span.start);
match &self.id {
TSEnumMemberName::StaticIdentifier(decl) => decl.print(p, ctx),
TSEnumMemberName::StaticStringLiteral(decl) => decl.print(p, ctx),
Expand Down
23 changes: 22 additions & 1 deletion crates/oxc_codegen/tests/integration/jsdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,28 @@ this.Book = function(title) {
/** The title of the book. */
this.title = title;
}
",
// https://github.com/oxc-project/oxc/issues/6006
export enum DefinitionKind {
/**
* Definition is a referenced variable.
*
* @example defineSomething(foo)
*/
Reference = 'Reference',
/**
* Definition is a `ObjectExpression`.
*
* @example defineSomething({ ... })
*/
Object = 'Object',
/**
* Definition is TypeScript interface.
*
* @example defineSomething<{ ... }>()
*/
TS = 'TS',
}
",
];

snapshot("jsodc", &cases);
Expand Down
43 changes: 42 additions & 1 deletion crates/oxc_codegen/tests/integration/snapshots/jsodc.snap
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,28 @@ this.Book = function(title) {
/** The title of the book. */
this.title = title;
}

// https://github.com/oxc-project/oxc/issues/6006
export enum DefinitionKind {
/**
* Definition is a referenced variable.
*
* @example defineSomething(foo)
*/
Reference = 'Reference',
/**
* Definition is a `ObjectExpression`.
*
* @example defineSomething({ ... })
*/
Object = 'Object',
/**
* Definition is TypeScript interface.
*
* @example defineSomething<{ ... }>()
*/
TS = 'TS',
}

----------
/** This is a description of the foo function. */
function foo() {}
Expand Down Expand Up @@ -119,3 +140,23 @@ this.Book = function(title) {
/** The title of the book. */
this.title = title;
};
export enum DefinitionKind {
/**
* Definition is a referenced variable.
*
* @example defineSomething(foo)
*/
Reference = 'Reference',
/**
* Definition is a `ObjectExpression`.
*
* @example defineSomething({ ... })
*/
Object = 'Object',
/**
* Definition is TypeScript interface.
*
* @example defineSomething<{ ... }>()
*/
TS = 'TS',
}