0
# Type System Helpers
1
2
Utilities for type checking, conversion, and property access operations commonly used in TypeScript and JavaScript.
3
4
## Capabilities
5
6
### Type Checking
7
8
#### _type_of
9
10
Enhanced typeof operator with proper null handling.
11
12
```javascript { .api }
13
/**
14
* Enhanced typeof operator with proper null handling
15
* @param {any} obj - Value to check type of
16
* @returns {string} Type string ("object", "function", "undefined", etc.)
17
*/
18
function _type_of(obj): string;
19
```
20
21
**Usage Example:**
22
23
```javascript
24
_type_of(null); // "object" (matches JS behavior)
25
_type_of([]); // "object"
26
_type_of(() => {}); // "function"
27
```
28
29
#### _instanceof
30
31
Enhanced instanceof operator with proper handling.
32
33
```javascript { .api }
34
/**
35
* Enhanced instanceof operator with proper handling
36
* @param {any} left - Value to check
37
* @param {Function} right - Constructor to check against
38
* @returns {boolean} True if left is instance of right
39
*/
40
function _instanceof(left, right): boolean;
41
```
42
43
### Type Conversion
44
45
#### _to_primitive
46
47
Converts values to primitive types.
48
49
```javascript { .api }
50
/**
51
* Converts values to primitive types
52
* @param {any} input - Value to convert
53
* @param {string} hint - Conversion hint ("string", "number", "default")
54
* @returns {any} Primitive value
55
*/
56
function _to_primitive(input, hint): any;
57
```
58
59
#### _to_property_key
60
61
Converts values to property keys.
62
63
```javascript { .api }
64
/**
65
* Converts values to property keys
66
* @param {any} arg - Value to convert to property key
67
* @returns {string|symbol} Property key
68
*/
69
function _to_property_key(arg): string | symbol;
70
```
71
72
### Property Operations
73
74
#### _define_property
75
76
Defines properties on objects with proper fallbacks.
77
78
```javascript { .api }
79
/**
80
* Defines properties on objects with proper fallbacks
81
* @param {Object} obj - Target object
82
* @param {string|symbol} key - Property key
83
* @param {any} value - Property value
84
* @returns {Object} Target object
85
*/
86
function _define_property(obj, key, value): Object;
87
```
88
89
#### _define_enumerable_properties
90
91
Defines multiple enumerable properties.
92
93
```javascript { .api }
94
/**
95
* Defines multiple enumerable properties
96
* @param {Object} target - Target object
97
* @param {Object} props - Properties to define
98
* @returns {Object} Target object
99
*/
100
function _define_enumerable_properties(target, props): Object;
101
```
102
103
### Prototype Operations
104
105
#### _get_prototype_of
106
107
Gets the prototype of an object.
108
109
```javascript { .api }
110
/**
111
* Gets the prototype of an object
112
* @param {Object} o - Object to get prototype of
113
* @returns {Object|null} Prototype object or null
114
*/
115
function _get_prototype_of(o): Object | null;
116
```
117
118
#### _set_prototype_of
119
120
Sets the prototype of an object.
121
122
```javascript { .api }
123
/**
124
* Sets the prototype of an object
125
* @param {Object} o - Object to set prototype on
126
* @param {Object|null} p - New prototype
127
* @returns {Object} Target object
128
*/
129
function _set_prototype_of(o, p): Object;
130
```
131
132
### Tagged Templates
133
134
#### _tagged_template_literal
135
136
Handles tagged template literal objects.
137
138
```javascript { .api }
139
/**
140
* Handles tagged template literal objects
141
* @param {Array} strings - Template strings array
142
* @param {Array} raw - Raw strings array
143
* @returns {Array} Template object with raw property
144
*/
145
function _tagged_template_literal(strings, raw): Array;
146
```
147
148
#### _tagged_template_literal_loose
149
150
Loose mode tagged template literal handling.
151
152
```javascript { .api }
153
/**
154
* Loose mode tagged template literal handling
155
* @param {Array} strings - Template strings array
156
* @param {Array} raw - Raw strings array
157
* @returns {Array} Template object
158
*/
159
function _tagged_template_literal_loose(strings, raw): Array;
160
```
161
162
### Arrow Function Helpers
163
164
#### _new_arrow_check
165
166
Prevents arrow functions from being called with new.
167
168
```javascript { .api }
169
/**
170
* Prevents arrow functions from being called with new
171
* @param {any} innerThis - Arrow function this context
172
* @param {any} boundThis - Bound this context
173
* @throws {TypeError} If arrow function called with new
174
*/
175
function _new_arrow_check(innerThis, boundThis): void;
176
```
177
178
### Identity Function
179
180
#### _identity
181
182
Simple identity function that returns its argument.
183
184
```javascript { .api }
185
/**
186
* Simple identity function that returns its argument
187
* @param {any} x - Value to return
188
* @returns {any} The input value unchanged
189
*/
190
function _identity(x): any;
191
```