KC's Workspace
    Preparing search index...
    interface CompilerAssumptions {
        ignoreFunctionLength?: boolean;
        noDocumentAll?: boolean;
        objectRestNoSymbols?: boolean;
        pureGetters?: boolean;
        setPublicClassFields?: boolean;
    }
    Index

    Properties

    ignoreFunctionLength?: boolean
    noDocumentAll?: boolean
    objectRestNoSymbols?: boolean
    pureGetters?: boolean
    setPublicClassFields?: boolean

    When using public class fields, assume that they don't shadow any getter in the current class, in its subclasses or in its superclass. Thus, it's safe to assign them rather than using Object.defineProperty.

    For example:

    Input:

    class Test {
    field = 2;

    static staticField = 3;
    }

    When set_public_class_fields is true, the output will be:

    class Test {
    constructor() {
    this.field = 2;
    }
    }
    Test.staticField = 3;

    Otherwise, the output will be:

    import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
    class Test {
    constructor() {
    _defineProperty(this, "field", 2);
    }
    }
    _defineProperty(Test, "staticField", 3);

    NOTE: For TypeScript, if you wanted behavior is equivalent to useDefineForClassFields: false, you should set both set_public_class_fields and [crate::TypeScriptOptions::remove_class_fields_without_initializer] to true.