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,
pub import_export_assign_config: TsImportExportAssignConfig,
}
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
§import_export_assign_config: TsImportExportAssignConfig
Trait Implementations§
source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
source§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>,
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more