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
4 changes: 3 additions & 1 deletion crates/oxc_isolated_declarations/src/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,15 @@ impl<'a> IsolatedDeclarations<'a> {
fn create_class_property(
&self,
r#type: PropertyDefinitionType,
span: Span,
key: PropertyKey<'a>,
r#static: bool,
r#override: bool,
accessibility: Option<TSAccessibility>,
) -> ClassElement<'a> {
self.ast.class_element_property_definition(
r#type,
SPAN,
span,
self.ast.vec(),
key,
None,
Expand Down Expand Up @@ -216,6 +217,7 @@ impl<'a> IsolatedDeclarations<'a> {
};
self.create_class_property(
r#type,
method.span,
// SAFETY: `ast.copy` is unsound! We need to fix.
unsafe { self.ast.copy(&method.key) },
method.r#static,
Expand Down
18 changes: 18 additions & 0 deletions crates/oxc_isolated_declarations/tests/fixtures/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,29 @@ export abstract class Qux {
}

export class Baz {
/**
* Just a comment
*/
readonly prop1 = 'some string';
/**
* Just a comment
*/
prop2 = 'another string';
/**
* Just a comment
*/
private prop3 = 'yet another string';
/**
* Just a comment
*/
private prop4(): void {}
/**
* Just a comment
*/
private static prop5 = 'yet another string';
/**
* Just a comment
*/
private static prop6(): void {}
}

Expand Down
18 changes: 18 additions & 0 deletions crates/oxc_isolated_declarations/tests/snapshots/class.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,29 @@ export declare abstract class Qux {
baz(): void;
}
export declare class Baz {
/**
* Just a comment
*/
readonly prop1 = "some string";
/**
* Just a comment
*/
prop2: string;
/**
* Just a comment
*/
private prop3;
/**
* Just a comment
*/
private prop4;
/**
* Just a comment
*/
private static prop5;
/**
* Just a comment
*/
private static prop6;
}
export declare class Boo {
Expand Down