mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 20:32:10 +00:00
feat(transformer/typescript): remove type-related exports (#2056)
This commit is contained in:
parent
95d741abd6
commit
3413bb3884
3 changed files with 25 additions and 6 deletions
|
|
@ -1110,6 +1110,18 @@ impl<'a> Declaration<'a> {
|
||||||
_ => true,
|
_ => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub fn modifiers(&self) -> Option<&Modifiers<'a>> {
|
||||||
|
match self {
|
||||||
|
Declaration::VariableDeclaration(decl) => Some(&decl.modifiers),
|
||||||
|
Declaration::FunctionDeclaration(decl) => Some(&decl.modifiers),
|
||||||
|
Declaration::ClassDeclaration(decl) => Some(&decl.modifiers),
|
||||||
|
Declaration::TSEnumDeclaration(decl) => Some(&decl.modifiers),
|
||||||
|
Declaration::TSTypeAliasDeclaration(decl) => Some(&decl.modifiers),
|
||||||
|
Declaration::TSModuleDeclaration(decl) => Some(&decl.modifiers),
|
||||||
|
Declaration::TSInterfaceDeclaration(decl) => Some(&decl.modifiers),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Variable Declaration
|
/// Variable Declaration
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,17 @@ impl<'a> TypeScript<'a> {
|
||||||
|
|
||||||
if decl.export_kind.is_type()
|
if decl.export_kind.is_type()
|
||||||
|| self.verbatim_module_syntax
|
|| self.verbatim_module_syntax
|
||||||
|| (decl.declaration.is_none() && decl.specifiers.is_empty())
|
|| ((decl.declaration.is_none()
|
||||||
|
|| decl.declaration.as_ref().is_some_and(|d| {
|
||||||
|
d.modifiers().is_some_and(|modifiers| {
|
||||||
|
modifiers.contains(ModifierKind::Declare)
|
||||||
|
}) || matches!(
|
||||||
|
d,
|
||||||
|
Declaration::TSInterfaceDeclaration(_)
|
||||||
|
| Declaration::TSTypeAliasDeclaration(_)
|
||||||
|
)
|
||||||
|
}))
|
||||||
|
&& decl.specifiers.is_empty())
|
||||||
{
|
{
|
||||||
delete_indexes.push(index);
|
delete_indexes.push(index);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
Passed: 308/1179
|
Passed: 311/1179
|
||||||
|
|
||||||
# All Passed:
|
# All Passed:
|
||||||
* babel-plugin-transform-numeric-separator
|
* babel-plugin-transform-numeric-separator
|
||||||
|
|
@ -832,7 +832,7 @@ Passed: 308/1179
|
||||||
* general/function-duplicate-name/input.js
|
* general/function-duplicate-name/input.js
|
||||||
* general/object/input.js
|
* general/object/input.js
|
||||||
|
|
||||||
# babel-plugin-transform-typescript (77/158)
|
# babel-plugin-transform-typescript (80/158)
|
||||||
* class/abstract-class-decorated/input.ts
|
* class/abstract-class-decorated/input.ts
|
||||||
* class/abstract-class-decorated-method/input.ts
|
* class/abstract-class-decorated-method/input.ts
|
||||||
* class/abstract-class-decorated-parameter/input.ts
|
* class/abstract-class-decorated-parameter/input.ts
|
||||||
|
|
@ -848,15 +848,12 @@ Passed: 308/1179
|
||||||
* class/parameter-properties-with-super/input.ts
|
* class/parameter-properties-with-super/input.ts
|
||||||
* class/private-method-override-transform-private/input.ts
|
* class/private-method-override-transform-private/input.ts
|
||||||
* class/transform-properties-declare-wrong-order/input.ts
|
* class/transform-properties-declare-wrong-order/input.ts
|
||||||
* declarations/erased/input.ts
|
|
||||||
* declarations/export-declare-enum/input.ts
|
|
||||||
* declarations/nested-namespace/input.mjs
|
* declarations/nested-namespace/input.mjs
|
||||||
* exports/declared-types/input.ts
|
* exports/declared-types/input.ts
|
||||||
* exports/export-const-enums/input.ts
|
* exports/export-const-enums/input.ts
|
||||||
* exports/export-type-star-from/input.ts
|
* exports/export-type-star-from/input.ts
|
||||||
* exports/export=/input.ts
|
* exports/export=/input.ts
|
||||||
* exports/export=-to-cjs/input.ts
|
* exports/export=-to-cjs/input.ts
|
||||||
* exports/issue-9916-3/input.ts
|
|
||||||
* function/overloads-exports/input.mjs
|
* function/overloads-exports/input.mjs
|
||||||
* imports/elide-injected/input.ts
|
* imports/elide-injected/input.ts
|
||||||
* imports/elide-no-import-specifiers/input.ts
|
* imports/elide-no-import-specifiers/input.ts
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue