Runtime helper functions for JavaScript and TypeScript transformations performed by the SWC compiler.
—
Support for decorator syntax including method decorators, class decorators, and property decorators.
Applies decorators to class members and classes.
/**
* Applies decorators to class members and classes
* @param {Array} decorators - Array of decorator functions
* @param {Function|Object} target - Target class or prototype
* @param {string|symbol} key - Property key (for member decorators)
* @param {Object} desc - Property descriptor
* @returns {any} Decorated result
*/
function _decorate(decorators, target, key, desc): any;Usage Example:
// For: @decorator class MyClass {}
_decorate([decorator], MyClass);
// For: @decorator method() {}
_decorate([decorator], MyClass.prototype, "method", descriptor);Applies decorated descriptors to object properties.
/**
* Applies decorated descriptors to object properties
* @param {Object} target - Target object
* @param {string|symbol} property - Property key
* @param {Array} decorators - Array of decorators
* @param {Object} descriptor - Original property descriptor
* @param {Object} context - Decorator context
* @returns {Object} Updated descriptor
*/
function _apply_decorated_descriptor(target, property, decorators, descriptor, context): Object;Applies Stage 3 decorators following the 2022-03 revision.
/**
* Applies Stage 3 decorators following the 2022-03 revision
* @param {Function} targetClass - Target class
* @param {Array} memberDecs - Member decorators
* @param {Array} classDecs - Class decorators
* @param {Array} classDecsHaveThis - Class decorators with this context
* @param {number} instanceBrand - Instance brand value
* @returns {Object} Decorated class information
*/
function _apply_decs_2203_r(targetClass, memberDecs, classDecs, classDecsHaveThis, instanceBrand): Object;Defines properties using initializer functions.
/**
* Defines properties using initializer functions
* @param {Object} target - Target object
* @param {string|symbol} key - Property key
* @param {Object} descriptor - Property descriptor
* @param {Object} context - Definition context
* @param {Function} initializer - Initializer function
*/
function _initializer_define_property(target, key, descriptor, context, initializer): void;Provides warnings for initializer usage.
/**
* Provides warnings for initializer usage
* @param {Object} descriptor - Property descriptor
* @param {Object} context - Usage context
* @returns {Function} Warning function
*/
function _initializer_warning_helper(descriptor, context): Function;Applies getter descriptors to class members.
/**
* Applies getter descriptors to class members
* @param {Object} target - Target object
* @param {Object} descriptor - Getter descriptor
* @returns {any} Getter result
*/
function _class_apply_descriptor_get(target, descriptor): any;Applies setter descriptors to class members.
/**
* Applies setter descriptors to class members
* @param {Object} target - Target object
* @param {Object} descriptor - Setter descriptor
* @param {any} value - Value to set
* @returns {any} Set value
*/
function _class_apply_descriptor_set(target, descriptor, value): any;Applies update descriptors to class members.
/**
* Applies update descriptors to class members
* @param {Object} target - Target object
* @param {Object} descriptor - Update descriptor
* @param {Function} updateFn - Update function
* @returns {any} Updated value
*/
function _class_apply_descriptor_update(target, descriptor, updateFn): any;Applies destructure descriptors to class members.
/**
* Applies destructure descriptors to class members
* @param {Object} target - Target object
* @param {Object} descriptor - Destructure descriptor
* @returns {any} Destructured value
*/
function _class_apply_descriptor_destructure(target, descriptor): any;Extracts field descriptors from class members.
/**
* Extracts field descriptors from class members
* @param {Object} target - Target object
* @param {string|symbol} key - Property key
* @param {boolean} isStatic - Whether field is static
* @returns {Object} Field descriptor
*/
function _class_extract_field_descriptor(target, key, isStatic): Object;TypeScript-specific decorator implementation (re-exported from tslib).
/**
* TypeScript-specific decorator implementation (re-exported from tslib.__decorate)
* @param {Array} decorators - Array of decorators
* @param {Function|Object} target - Target class or prototype
* @param {string|symbol} key - Property key
* @param {Object} descriptor - Property descriptor
* @returns {any} Decorated result
*/
function _ts_decorate(decorators, target, key, descriptor): any;Handles TypeScript metadata for decorators (re-exported from tslib).
/**
* Handles TypeScript metadata for decorators (re-exported from tslib.__metadata)
* @param {string} metadataKey - Metadata key
* @param {any} metadataValue - Metadata value
* @returns {Function} Metadata decorator
*/
function _ts_metadata(metadataKey, metadataValue): Function;TypeScript parameter decorator helper (re-exported from tslib).
/**
* TypeScript parameter decorator helper (re-exported from tslib.__param)
* @param {number} paramIndex - Parameter index
* @param {Function} decorator - Parameter decorator
* @returns {Function} Parameter decorator function
*/
function _ts_param(paramIndex, decorator): Function;Install with Tessl CLI
npx tessl i tessl/npm-swc--helpers