OptionalallowOptionalallowOptionaldeclarationAlso generate a .d.ts declaration file for TypeScript files.
The source file must be compliant with all
isolatedDeclarations
requirements.
OptionaljsxOptionaljsxOptionalonlyOptionalremoveWhen enabled, class fields without initializers are removed.
For example:
class Foo {
x: number;
y: number = 0;
}
// transform into
class Foo {
x: number;
}
The option is used to align with the behavior of TypeScript's useDefineForClassFields: false option.
When you want to enable this, you also need to set [crate::CompilerAssumptions::set_public_class_fields]
to true. The set_public_class_fields: true + remove_class_fields_without_initializer: true is
equivalent to useDefineForClassFields: false in TypeScript.
When set_public_class_fields is true and class-properties plugin is enabled, the above example transforms into:
class Foo {
constructor() {
this.y = 0;
}
}
Defaults to false.
OptionalrewriteRewrite or remove TypeScript import/export declaration extensions.
rewrite, it will change .ts, .mts, .cts extensions to .js, .mjs, .cjs respectively.remove, it will remove .ts/.mts/.cts/.tsx extension entirely.true, it's equivalent to rewrite.false or omitted, no changes will be made to the extensions.
When enabled, type-only class fields are only removed if they are prefixed with the declare modifier: