Runtime helper functions for JavaScript and TypeScript transformations performed by the SWC compiler.
—
General-purpose utility functions for error handling, property operations, resource management, and other common runtime needs.
Throws an error (used for expression contexts).
/**
* Throws an error (used for expression contexts)
* @param {Error} error - Error to throw
* @throws {Error} The provided error
*/
function _throw(error): never;Usage Example:
// In expressions where throw is needed
const value = condition ? validValue : _throw(new Error("Invalid condition"));Throws a read-only property error.
/**
* Throws a read-only property error
* @param {string} name - Property name
* @throws {TypeError} Read-only property error
*/
function _read_only_error(name): never;Throws a write-only property error.
/**
* Throws a write-only property error
* @param {string} name - Property name
* @throws {TypeError} Write-only property error
*/
function _write_only_error(name): never;Handles resource disposal for using declarations.
/**
* Handles resource disposal for using declarations
* @param {Array} stack - Disposal stack
* @param {Error} error - Current error
* @param {boolean} hasError - Whether an error occurred
* @returns {Promise|void} Disposal result
*/
function _dispose(stack, error, hasError): Promise<void> | void;Creates using declaration contexts.
/**
* Creates using declaration contexts
* @param {any} disposable - Disposable resource
* @param {Array} stack - Disposal stack
* @param {boolean} isAsync - Whether disposal is async
* @returns {any} The disposable resource
*/
function _using(disposable, stack, isAsync): any;Creates using declaration context objects.
/**
* Creates using declaration context objects
* @returns {Object} Using context with disposal stack
*/
function _using_ctx(): Object;TypeScript-specific disposable resource handling (re-exported from tslib).
/**
* TypeScript-specific disposable resource handling (re-exported from tslib.__addDisposableResource)
* @param {Object} env - Environment object
* @param {any} value - Disposable value
* @param {boolean} async - Whether disposal is async
* @returns {any} The disposable value
*/
function _ts_add_disposable_resource(env, value, async): any;TypeScript-specific resource disposal (re-exported from tslib).
/**
* TypeScript-specific resource disposal (re-exported from tslib.__disposeResources)
* @param {Object} env - Environment object with disposal stack
* @returns {Promise|void} Disposal result
*/
function _ts_dispose_resources(env): Promise<void> | void;Creates JSX elements (React elements).
/**
* Creates JSX elements (React elements)
* @param {string|Function} type - Element type
* @param {Object} props - Element properties
* @param {string|number} key - Element key
* @param {...any} children - Child elements
* @returns {Object} React element object
*/
function _jsx(type, props, key, children): Object;Usage Example:
// For: <div className="container">Hello</div>
const element = _jsx("div", { className: "container" }, undefined, "Hello");Install with Tessl CLI
npx tessl i tessl/npm-swc--helpers