mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(isolated_declarations): Class properties should still be lifted from private constructors (#4934)
Before, this
```ts
export class Bux {
private constructor(
public readonly prop: number = 0,
private readonly prop2: number = 1,
readonly prop3: number = 1,
) {}
}
```
would be emitted as
```ts
export declare class Bux {
private constructor();
}
```
Now it will be emitted as
```ts
export declare class Bux {
readonly prop: number;
private readonly prop2;
readonly prop3: number;
private constructor();
}
```
Co-authored-by: MichaelMitchell-at <=>
This commit is contained in:
parent
7ecf0efd40
commit
8e80f593fd
3 changed files with 19 additions and 4 deletions
|
|
@ -375,10 +375,6 @@ impl<'a> IsolatedDeclarations<'a> {
|
|||
if self.report_property_key(&method.key, method.computed) {
|
||||
continue;
|
||||
}
|
||||
if method.accessibility.is_some_and(TSAccessibility::is_private) {
|
||||
elements.push(self.transform_private_modifier_method(method));
|
||||
continue;
|
||||
}
|
||||
|
||||
let inferred_accessor_types = self.collect_inferred_accessor_types(decl);
|
||||
let function = &method.value;
|
||||
|
|
@ -407,6 +403,11 @@ impl<'a> IsolatedDeclarations<'a> {
|
|||
);
|
||||
}
|
||||
|
||||
if method.accessibility.is_some_and(TSAccessibility::is_private) {
|
||||
elements.push(self.transform_private_modifier_method(method));
|
||||
continue;
|
||||
}
|
||||
|
||||
let return_type = match method.kind {
|
||||
MethodDefinitionKind::Method => {
|
||||
let rt = self.infer_function_return_type(function);
|
||||
|
|
|
|||
|
|
@ -35,3 +35,11 @@ export class Boo {
|
|||
readonly prop3: number = 1,
|
||||
) {}
|
||||
}
|
||||
|
||||
export class Bux {
|
||||
private constructor(
|
||||
public readonly prop: number = 0,
|
||||
private readonly prop2: number = 1,
|
||||
readonly prop3: number = 1,
|
||||
) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,3 +33,9 @@ export declare class Boo {
|
|||
readonly prop3: number;
|
||||
constructor(prop?: number, prop2?: number, prop3?: number);
|
||||
}
|
||||
export declare class Bux {
|
||||
readonly prop: number;
|
||||
private readonly prop2;
|
||||
readonly prop3: number;
|
||||
private constructor();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue