mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(isolated-declarations): do not infer type for private parameters (#4105)
close: #4033
This commit is contained in:
parent
0f026089d1
commit
e67c7d1b01
2 changed files with 7 additions and 3 deletions
|
|
@ -241,8 +241,12 @@ impl<'a> IsolatedDeclarations<'a> {
|
|||
let mut elements = self.ast.new_vec();
|
||||
for (index, param) in function.params.items.iter().enumerate() {
|
||||
if param.accessibility.is_some() || param.readonly {
|
||||
// transformed params will definitely have type annotation
|
||||
let type_annotation = self.ast.copy(¶ms.items[index].pattern.type_annotation);
|
||||
let type_annotation = if param.accessibility.is_some_and(|a| a.is_private()) {
|
||||
None
|
||||
} else {
|
||||
// transformed params will definitely have type annotation
|
||||
self.ast.copy(¶ms.items[index].pattern.type_annotation)
|
||||
};
|
||||
if let Some(new_element) =
|
||||
self.transform_formal_parameter_to_class_property(param, type_annotation)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export declare class Baz {
|
|||
}
|
||||
export declare class Boo {
|
||||
readonly prop: number;
|
||||
private readonly prop2: number;
|
||||
private readonly prop2;
|
||||
readonly prop3: number;
|
||||
constructor(prop?: number, prop2?: number, prop3?: number);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue