fix(transformer/typescript): declare class incorrectly preserved as runtime class (#3997)

fix: #3993
This commit is contained in:
Dunqing 2024-07-01 16:04:39 +00:00
parent d0eac46fc8
commit bdee156c5d
4 changed files with 13 additions and 3 deletions

View file

@ -83,7 +83,10 @@ impl<'a> TypeScriptAnnotations<'a> {
});
!decl.specifiers.is_empty()
|| matches!(&decl.declaration, Some(decl) if !decl.is_typescript_syntax())
|| decl
.declaration
.as_ref()
.is_some_and(|decl| !decl.is_typescript_syntax())
}
}
Statement::ExportAllDeclaration(decl) => !decl.export_kind.is_type(),
@ -170,7 +173,6 @@ impl<'a> TypeScriptAnnotations<'a> {
class.super_type_parameters = None;
class.implements = None;
class.r#abstract = false;
class.declare = false;
}
pub fn transform_class_body(&mut self, body: &mut ClassBody<'a>) {

View file

@ -1,6 +1,6 @@
commit: 12619ffe
Passed: 5/5
Passed: 6/6
# All Passed:
* babel-plugin-transform-typescript

View file

@ -0,0 +1,7 @@
declare const ReactiveMarkerSymbol: unique symbol
export declare class ReactiveMarker {
private [ReactiveMarkerSymbol]?: void
}
export declare const A = 1