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>,
pub ts_enum_config: TSEnumConfig,
}
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
ts_enum_config: TSEnumConfig
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
sourcefn 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 Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more