Struct swc_ecma_transforms_typescript::strip::Config
source ·
[−]pub struct Config {
pub import_not_used_as_values: ImportsNotUsedAsValues,
pub use_define_for_class_fields: bool,
pub no_empty_export: bool,
pub pragma: Option<String>,
pub pragma_frag: Option<String>,
}
Fields
import_not_used_as_values: ImportsNotUsedAsValues
use_define_for_class_fields: bool
Align the semantics of TS class fields with TC39 class fields. Defaults
to false
.
See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier.
When running tsc
with configuration "target": "ESNext", "useDefineForClassFields": true
, TS class fields are preserved as JS
class fields. We target ESNext, so this our behavior with
use_define_for_class_fields: true
.
When running tsc
with configuration "target": "<ES6-ES2020>", "useDefineForClassFields": true
, TS class fields are transformed to
Object.defineProperty()
statements. You must additionally apply the
swc_ecmascript::transforms::compat::es2022::class_properties()
pass to
get this backward-compatible output.
no_empty_export: bool
Don’t create export {}
.
By default, strip creates export {}
for modules to preserve module
context.
https://github.com/swc-project/swc/issues/1698
pragma: Option<String>
Note: this pass handle jsx directives in comments
pragma_frag: Option<String>
Note: this pass handle jsx directives in comments
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for Config
impl UnwindSafe for Config
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more