From 4a9027cdea173d1f1f5f9d99746afd341ee4311e Mon Sep 17 00:00:00 2001 From: MichaelMitchell-at <=> Date: Sat, 6 Jul 2024 00:13:21 -0400 Subject: [PATCH] fix(isolated_declarations): correct emit for private static methods --- crates/oxc_isolated_declarations/src/class.rs | 4 +++- crates/oxc_isolated_declarations/tests/fixtures/class.ts | 4 ++++ crates/oxc_isolated_declarations/tests/snapshots/class.snap | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/oxc_isolated_declarations/src/class.rs b/crates/oxc_isolated_declarations/src/class.rs index 474d8c9556047..6d953758f72b6 100644 --- a/crates/oxc_isolated_declarations/src/class.rs +++ b/crates/oxc_isolated_declarations/src/class.rs @@ -142,6 +142,7 @@ impl<'a> IsolatedDeclarations<'a> { &self, r#type: PropertyDefinitionType, key: PropertyKey<'a>, + r#static: bool, r#override: bool, accessibility: Option, ) -> ClassElement<'a> { @@ -151,7 +152,7 @@ impl<'a> IsolatedDeclarations<'a> { key, None, false, - false, + r#static, false, r#override, false, @@ -205,6 +206,7 @@ impl<'a> IsolatedDeclarations<'a> { self.create_class_property( r#type, self.ast.copy(&method.key), + method.r#static, method.r#override, self.transform_accessibility(method.accessibility), ) diff --git a/crates/oxc_isolated_declarations/tests/fixtures/class.ts b/crates/oxc_isolated_declarations/tests/fixtures/class.ts index 209c7025f867f..4a3d7c2a024ff 100644 --- a/crates/oxc_isolated_declarations/tests/fixtures/class.ts +++ b/crates/oxc_isolated_declarations/tests/fixtures/class.ts @@ -22,6 +22,10 @@ export abstract class Qux { export class Baz { readonly prop1 = 'some string'; prop2 = 'another string'; + private prop3 = 'yet another string'; + private prop4(): void {} + private static prop5 = 'yet another string'; + private static prop6(): void {} } export class Boo { diff --git a/crates/oxc_isolated_declarations/tests/snapshots/class.snap b/crates/oxc_isolated_declarations/tests/snapshots/class.snap index ab5cde1af9366..2101b8b656efc 100644 --- a/crates/oxc_isolated_declarations/tests/snapshots/class.snap +++ b/crates/oxc_isolated_declarations/tests/snapshots/class.snap @@ -22,6 +22,10 @@ export declare abstract class Qux { export declare class Baz { readonly prop1: 'some string'; prop2: string; + private prop3; + private prop4; + private static prop5; + private static prop6; } export declare class Boo { readonly prop: number;