Runtime helper functions for JavaScript and TypeScript transformations performed by the SWC compiler.
—
Utilities for type checking, conversion, and property access operations commonly used in TypeScript and JavaScript.
Enhanced typeof operator with proper null handling.
/**
* Enhanced typeof operator with proper null handling
* @param {any} obj - Value to check type of
* @returns {string} Type string ("object", "function", "undefined", etc.)
*/
function _type_of(obj): string;Usage Example:
_type_of(null); // "object" (matches JS behavior)
_type_of([]); // "object"
_type_of(() => {}); // "function"Enhanced instanceof operator with proper handling.
/**
* Enhanced instanceof operator with proper handling
* @param {any} left - Value to check
* @param {Function} right - Constructor to check against
* @returns {boolean} True if left is instance of right
*/
function _instanceof(left, right): boolean;Converts values to primitive types.
/**
* Converts values to primitive types
* @param {any} input - Value to convert
* @param {string} hint - Conversion hint ("string", "number", "default")
* @returns {any} Primitive value
*/
function _to_primitive(input, hint): any;Converts values to property keys.
/**
* Converts values to property keys
* @param {any} arg - Value to convert to property key
* @returns {string|symbol} Property key
*/
function _to_property_key(arg): string | symbol;Defines properties on objects with proper fallbacks.
/**
* Defines properties on objects with proper fallbacks
* @param {Object} obj - Target object
* @param {string|symbol} key - Property key
* @param {any} value - Property value
* @returns {Object} Target object
*/
function _define_property(obj, key, value): Object;Defines multiple enumerable properties.
/**
* Defines multiple enumerable properties
* @param {Object} target - Target object
* @param {Object} props - Properties to define
* @returns {Object} Target object
*/
function _define_enumerable_properties(target, props): Object;Gets the prototype of an object.
/**
* Gets the prototype of an object
* @param {Object} o - Object to get prototype of
* @returns {Object|null} Prototype object or null
*/
function _get_prototype_of(o): Object | null;Sets the prototype of an object.
/**
* Sets the prototype of an object
* @param {Object} o - Object to set prototype on
* @param {Object|null} p - New prototype
* @returns {Object} Target object
*/
function _set_prototype_of(o, p): Object;Handles tagged template literal objects.
/**
* Handles tagged template literal objects
* @param {Array} strings - Template strings array
* @param {Array} raw - Raw strings array
* @returns {Array} Template object with raw property
*/
function _tagged_template_literal(strings, raw): Array;Loose mode tagged template literal handling.
/**
* Loose mode tagged template literal handling
* @param {Array} strings - Template strings array
* @param {Array} raw - Raw strings array
* @returns {Array} Template object
*/
function _tagged_template_literal_loose(strings, raw): Array;Prevents arrow functions from being called with new.
/**
* Prevents arrow functions from being called with new
* @param {any} innerThis - Arrow function this context
* @param {any} boundThis - Bound this context
* @throws {TypeError} If arrow function called with new
*/
function _new_arrow_check(innerThis, boundThis): void;Simple identity function that returns its argument.
/**
* Simple identity function that returns its argument
* @param {any} x - Value to return
* @returns {any} The input value unchanged
*/
function _identity(x): any;Install with Tessl CLI
npx tessl i tessl/npm-swc--helpers