fix(isolated-declarations): should not transform signature that has type annotation (#5927)

This commit is contained in:
Dunqing 2024-09-20 14:19:04 +00:00
parent b6a9178075
commit f07ff14876
3 changed files with 16 additions and 2 deletions

View file

@ -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);
}
};

View file

@ -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)
}

View file

@ -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);
}