Skip to content

Commit

Permalink
fix(isolated-declarations): should not transform signature that has t…
Browse files Browse the repository at this point in the history
…ype annotation (#5927)
  • Loading branch information
Dunqing committed Sep 20, 2024
1 parent b6a9178 commit f07ff14
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/oxc_isolated_declarations/src/signatures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ impl<'a> IsolatedDeclarations<'a> {
};

let entry = method_annotations.entry(name).or_default();
entry.0 |= first_param.pattern.type_annotation.is_some();
entry.0 |= first_param.pattern.type_annotation.is_none();
entry.1 = Some(&mut first_param.pattern.type_annotation);
}
TSMethodSignatureKind::Get => {
let entry = method_annotations.entry(name).or_default();
entry.0 |= method.return_type.is_some();
entry.0 |= method.return_type.is_none();
entry.2 = Some(&mut method.return_type);
}
};
Expand Down
7 changes: 7 additions & 0 deletions crates/oxc_isolated_declarations/tests/fixtures/signatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ export interface I {
set value(_);
get value(): string;
}


// Do nothing
export interface Ref<T = any, S = T> {
get value(): T
set value(_: S)
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@ export interface I {
set value(_: string);
get value(): string;
}
export interface Ref<
T = any,
S = T
> {
get value(): T;
set value(_: S);
}

0 comments on commit f07ff14

Please sign in to comment.