@rzl-zone/utils-js 3.0.2-beta.2 → 3.1.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/dist/NumberRangeUnion-DC-C3_Kq.d.ts +23 -23
  2. package/dist/any-BmdI8UbK.d.ts +56 -56
  3. package/dist/arrays-normalize-recursive-CnjYJ9xg.d.ts +66 -66
  4. package/dist/assertions/index.cjs +1 -1
  5. package/dist/assertions/index.d.ts +398 -418
  6. package/dist/assertions/index.js +1 -1
  7. package/dist/chunk-26W3VZIK.cjs +1 -0
  8. package/dist/chunk-2KRCHXFG.cjs +2 -0
  9. package/dist/chunk-33ZLH266.js +1 -0
  10. package/dist/{chunk-EXZ47NOW.js → chunk-4L4EJTNZ.js} +1 -1
  11. package/dist/chunk-5Q37AP7P.js +1 -0
  12. package/dist/chunk-7CHFAMS2.js +1 -0
  13. package/dist/chunk-7MMJZ6HS.js +1 -0
  14. package/dist/chunk-7TC6DE3J.cjs +1 -0
  15. package/dist/{chunk-XH6MCRLP.js → chunk-7VX33E3V.js} +1 -1
  16. package/dist/chunk-BEZPD44N.cjs +1 -0
  17. package/dist/chunk-BI263OHW.js +1 -0
  18. package/dist/chunk-CII6WWLO.cjs +1 -0
  19. package/dist/chunk-D5TYPCWU.cjs +1 -0
  20. package/dist/chunk-EEQY5QUG.js +1 -0
  21. package/dist/chunk-ESJYBIYH.js +1 -0
  22. package/dist/chunk-EWYPSKKM.js +1 -0
  23. package/dist/chunk-EXCOQLWX.cjs +1 -0
  24. package/dist/chunk-FWQVTMYA.cjs +1 -0
  25. package/dist/chunk-G4EWCRKS.js +1 -0
  26. package/dist/chunk-G7R5XZRM.cjs +1 -0
  27. package/dist/chunk-GGEV7LXX.cjs +1 -0
  28. package/dist/chunk-HJOZOENU.cjs +1 -0
  29. package/dist/{chunk-BYZAD3XN.cjs → chunk-IRDZVLNZ.cjs} +1 -1
  30. package/dist/chunk-IW73G523.cjs +1 -0
  31. package/dist/chunk-IY5OZAB3.cjs +1 -0
  32. package/dist/chunk-J4NCYYGS.js +1 -0
  33. package/dist/chunk-J7JAZAJD.js +1 -0
  34. package/dist/{chunk-FF76ISQ2.js → chunk-JYNSO7ZY.js} +1 -1
  35. package/dist/chunk-K3UVKYEU.js +1 -0
  36. package/dist/chunk-LQ76EDZG.js +1 -0
  37. package/dist/chunk-MROH35V3.cjs +1 -0
  38. package/dist/chunk-NJSAV73S.js +1 -0
  39. package/dist/chunk-NR44SNYE.js +1 -0
  40. package/dist/chunk-NXMTWY77.js +1 -0
  41. package/dist/chunk-OZCQZO2V.cjs +4 -0
  42. package/dist/chunk-Q3NTKN5I.cjs +1 -0
  43. package/dist/chunk-QDNSC57Z.js +4 -0
  44. package/dist/chunk-QGXTL5ZH.js +2 -0
  45. package/dist/{chunk-JWHM3WZQ.cjs → chunk-QSQDP7L2.cjs} +1 -1
  46. package/dist/{chunk-RN3TP3S3.js → chunk-S5M33A4O.js} +1 -1
  47. package/dist/chunk-SGTHOQQ2.js +1 -0
  48. package/dist/chunk-SL3RQOWA.js +1 -0
  49. package/dist/chunk-SZPWZZYG.cjs +1 -0
  50. package/dist/chunk-UA4B7JBO.cjs +1 -0
  51. package/dist/chunk-UQDJF5RR.cjs +1 -0
  52. package/dist/chunk-UTQUYABU.cjs +1 -0
  53. package/dist/chunk-VPW3DRV5.js +1 -0
  54. package/dist/chunk-W32WALNU.js +1 -0
  55. package/dist/chunk-XGZ6K753.cjs +1 -0
  56. package/dist/chunk-YFTR64N5.cjs +1 -0
  57. package/dist/chunk-ZFDS7W6B.cjs +1 -0
  58. package/dist/chunk-ZQOLZE6Z.cjs +1 -0
  59. package/dist/conversions/index.cjs +1 -1
  60. package/dist/conversions/index.d.ts +1307 -1504
  61. package/dist/conversions/index.js +1 -1
  62. package/dist/env/index.d.ts +14 -17
  63. package/dist/events/index.cjs +1 -1
  64. package/dist/events/index.d.ts +111 -108
  65. package/dist/events/index.js +1 -1
  66. package/dist/extends-Bk_SBGdT.d.ts +367 -0
  67. package/dist/formatting/index.cjs +1 -1
  68. package/dist/formatting/index.d.ts +878 -840
  69. package/dist/formatting/index.js +1 -1
  70. package/dist/generator/index.cjs +1 -1
  71. package/dist/generator/index.d.ts +173 -150
  72. package/dist/generator/index.js +1 -1
  73. package/dist/if-CvT4R7Kh.d.ts +16 -16
  74. package/dist/index.cjs +1 -1
  75. package/dist/index.d.ts +1 -1
  76. package/dist/index.js +1 -1
  77. package/dist/is-array--YjXV-Wx.d.ts +1207 -0
  78. package/dist/isPlainObject-BVhBAPHX.d.ts +169 -0
  79. package/dist/never-BfayMBF9.d.ts +64 -64
  80. package/dist/next/index.cjs +6 -6
  81. package/dist/next/index.d.ts +196 -176
  82. package/dist/next/index.js +5 -5
  83. package/dist/next/server/index.cjs +1 -1
  84. package/dist/next/server/index.d.ts +26 -40
  85. package/dist/next/server/index.js +1 -1
  86. package/dist/nils-DMz3kU7M.d.ts +155 -155
  87. package/dist/omit-VvmIsZmX.d.ts +25 -25
  88. package/dist/operations/index.cjs +1 -1
  89. package/dist/operations/index.d.ts +121 -176
  90. package/dist/operations/index.js +1 -1
  91. package/dist/parsers/index.cjs +1 -1
  92. package/dist/parsers/index.d.ts +35 -36
  93. package/dist/parsers/index.js +1 -1
  94. package/dist/predicates/index.cjs +1 -1
  95. package/dist/predicates/index.d.ts +1701 -1675
  96. package/dist/predicates/index.js +1 -1
  97. package/dist/prettify-C4xLcYOP.d.ts +328 -328
  98. package/dist/promise/index.cjs +1 -1
  99. package/dist/promise/index.d.ts +29 -38
  100. package/dist/promise/index.js +1 -1
  101. package/dist/rzl-utils.global.js +3 -3
  102. package/dist/string-XA-til3C.d.ts +351 -0
  103. package/dist/strings/index.cjs +1 -1
  104. package/dist/strings/index.d.ts +712 -787
  105. package/dist/strings/index.js +1 -1
  106. package/dist/stylings/index.cjs +1 -1
  107. package/dist/stylings/index.d.ts +37 -45
  108. package/dist/stylings/index.js +1 -1
  109. package/dist/type-data-DDs-u2kq.d.ts +241 -241
  110. package/dist/types/index.d.ts +3266 -3266
  111. package/dist/urls/index.cjs +1 -1
  112. package/dist/urls/index.d.ts +384 -409
  113. package/dist/urls/index.js +1 -1
  114. package/package.json +53 -11
  115. package/dist/array-CIZRbqTF.d.ts +0 -223
  116. package/dist/chunk-2TRAPBZ7.cjs +0 -1
  117. package/dist/chunk-3D74QO5D.cjs +0 -1
  118. package/dist/chunk-4DK3RCC4.js +0 -2
  119. package/dist/chunk-4JOQ45HL.js +0 -1
  120. package/dist/chunk-55CZALRS.js +0 -1
  121. package/dist/chunk-5JFV3GDE.cjs +0 -4
  122. package/dist/chunk-62HX5Z45.cjs +0 -1
  123. package/dist/chunk-7NA6DUHR.cjs +0 -2
  124. package/dist/chunk-BVPMMWDL.cjs +0 -1
  125. package/dist/chunk-CEFYHEM4.cjs +0 -1
  126. package/dist/chunk-CN53M4QZ.cjs +0 -1
  127. package/dist/chunk-D47MHBSD.cjs +0 -1
  128. package/dist/chunk-DGH75GJD.js +0 -1
  129. package/dist/chunk-E5NUI7PN.js +0 -1
  130. package/dist/chunk-FDITZ5C6.cjs +0 -1
  131. package/dist/chunk-FSSV24W7.cjs +0 -1
  132. package/dist/chunk-GCGU2WB7.js +0 -1
  133. package/dist/chunk-GECI2YBP.js +0 -1
  134. package/dist/chunk-GQE4OVHC.cjs +0 -1
  135. package/dist/chunk-GRVZXQXL.cjs +0 -1
  136. package/dist/chunk-I4AVNHPA.cjs +0 -1
  137. package/dist/chunk-JFRL7NKU.js +0 -4
  138. package/dist/chunk-KCQDDZJE.cjs +0 -1
  139. package/dist/chunk-L54ZPSYJ.js +0 -1
  140. package/dist/chunk-LVKAYEZ4.js +0 -1
  141. package/dist/chunk-MBDWTK54.cjs +0 -1
  142. package/dist/chunk-MNGGDB2G.js +0 -1
  143. package/dist/chunk-MY7BA4GI.cjs +0 -1
  144. package/dist/chunk-N2IJPIND.cjs +0 -1
  145. package/dist/chunk-NIMNTEGV.js +0 -1
  146. package/dist/chunk-PVJF2JHM.js +0 -1
  147. package/dist/chunk-QCFXEUKL.js +0 -1
  148. package/dist/chunk-QFCGBBSY.js +0 -1
  149. package/dist/chunk-QQYAUPSK.cjs +0 -1
  150. package/dist/chunk-TC4VBE4Y.cjs +0 -1
  151. package/dist/chunk-TUXDINHF.cjs +0 -1
  152. package/dist/chunk-U5Y2FXMN.cjs +0 -1
  153. package/dist/chunk-UUPQI6ND.cjs +0 -1
  154. package/dist/chunk-VYCGZ2S6.js +0 -1
  155. package/dist/chunk-W5EDKJK3.js +0 -1
  156. package/dist/chunk-WHAVUFEU.js +0 -1
  157. package/dist/chunk-XCFIOTCV.js +0 -1
  158. package/dist/chunk-XE27XPJR.js +0 -1
  159. package/dist/chunk-XVB3ZZEB.js +0 -1
  160. package/dist/chunk-ZBSIGJFO.cjs +0 -1
  161. package/dist/chunk-ZYAML74V.js +0 -1
  162. package/dist/extends-Mp81Hq9-.d.ts +0 -145
  163. package/dist/is-array-Ckm_47hw.d.ts +0 -1557
  164. package/dist/isPlainObject-BKYaI6a8.d.ts +0 -182
@@ -1,428 +1,408 @@
1
- import{G as GetPreciseTypeOptions,I as IsNumberOptions,a as IsPlainObjectResult}from'../isPlainObject-BKYaI6a8.js';import'../type-data-DDs-u2kq.js';
1
+ import{G as GetPreciseTypeOptions,I as IsNumberOptions,a as IsPlainObjectResult}from'../isPlainObject-BVhBAPHX.js';import'../type-data-DDs-u2kq.js';
2
2
  /** -------------------------------------------------------
3
- * * ***Shape of the object passed to custom error message functions.***
4
- * -------------------------------------------------------
5
- * This type describes the parameters received when `options.message`
6
- * is defined as a function in `AssertIsOptions`.
7
- *
8
- * - `currentType` ➔ the actual detected runtime type of the value.
9
- * - `validType` ➔ the required/expected type name that the value must match.
10
- *
11
- * @example
12
- * ```ts
13
- * const options: AssertIsOptions = {
14
- * message: ({ currentType, validType }) =>
15
- * `Expected ${validType} but got ${currentType}`
16
- * };
17
- * ```
18
- */
19
- type AssertIsOptionsMessageFunction={
3
+ * * ***Shape of the object passed to custom error message functions.***
4
+ * -------------------------------------------------------
5
+ * This type describes the parameters received when `options.message`
6
+ * is defined as a function in `OptionsAssertIs`.
7
+ *
8
+ * - `currentType` ➔ the actual detected runtime type of the value.
9
+ * - `validType` ➔ the required/expected type name that the value must match.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const options: OptionsAssertIs = {
14
+ * message: ({ currentType, validType }) =>
15
+ * `Expected ${validType} but got ${currentType}`
16
+ * };
17
+ * ```
18
+ */
19
+ type OptionsMessageFunctionAssertIs={
20
20
  /** The actual runtime type of the value being checked.
21
- *
22
- * - Example: `"number"`, `"big-int"`, `"plain-object"`, (depends `formatCase` options).
23
- */
21
+ *
22
+ * - Example: `"number"`, `"big-int"`, `"plain-object"`, (depends `formatCase` options).
23
+ */
24
24
  currentType:string;
25
25
  /** The required/expected type that the value must conform to.
26
- *
27
- * - Example: `"boolean"`, `"string"`, `"big-int"`, `"plain-object"`, (will force format to `kebab-case`).
28
- */
29
- validType:string;};type AssertIsOptions={
30
- /** Custom error message for assertion failures.
31
- *
32
- * This option allows overriding the **default error message** when a value
33
- * does not match the required type.
34
- *
35
- * - If a **string** is provided:
36
- * - Must be non-empty after trimming.
37
- * - Will be used directly as the error message.
38
- *
39
- * - If a **function** is provided:
40
- * - Receives an object containing:
41
- * - `currentType` ➔ the detected runtime type of the value (depends `formatCase` options, e.g., `"number"`).
42
- * - `validType` ➔ the expected type name (with format `kebab-case`, e.g., `"boolean"`, `"big-int"`, `"plain-object"`).
43
- * - Must return a string. If the returned string is empty or whitespace,
44
- * the default message will be used instead.
45
- *
46
- * @example
47
- * ```ts
48
- * // Static message
49
- * { message: "Must be a boolean!" }
50
- *
51
- * // Dynamic message
52
- * {
53
- * message: ({ currentType, validType }) =>
54
- * `Expected ${validType} but got ${currentType}`
55
- * }
56
- * ```
57
- */
58
- message?:string|(({currentType,validType}:AssertIsOptionsMessageFunction)=>string);}& GetPreciseTypeOptions;
26
+ *
27
+ * - Example: `"boolean"`, `"string"`, `"big-int"`, `"plain-object"`, (will force format to `kebab-case`).
28
+ */
29
+ validType:string;};type OptionsAssertIs={
59
30
  /** -------------------------------------------------------
60
- * * ***Asserts that a value is of type `boolean`.***
61
- * -------------------------------------------------------
62
- * Validates that the given `value` is a **boolean**.
63
- *
64
- * - If `value` is a boolean execution continues normally.
65
- * - ❌ If `value` is not a boolean throws a `TypeError` with either:
66
- * - A custom error message (`options.message`), or
67
- * - A default message including the actual type.
68
- *
69
- * This function is an **assertion function**.
70
- * After it returns successfully, TypeScript narrows the type of `value` to `boolean`.
71
- *
72
- * @param value - The value to validate.
73
- * @param options - Optional configuration:
74
- * - `message`: A custom error message (string or function).
75
- * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
76
- *
77
- * @returns {asserts value is boolean} Narrows `value` to `boolean` if no error is thrown.
78
- * @throws {TypeError} If the value is not a boolean.
79
- *
80
- * @example
81
- * ```ts
82
- * // ✅ Simple usage
83
- * assertIsBoolean(true);
84
- * // No error, value is boolean
85
- *
86
- * // Throws TypeError with default message
87
- * assertIsBoolean(42);
88
- * // ➔ TypeError: "Parameter input (`value`) must be of type `boolean`, but received: `number`."
89
- *
90
- * // ❌ Throws with custom string message
91
- * assertIsBoolean(42, { message: "Must be boolean!" });
92
- * // ➔ TypeError: "Must be boolean!"
93
- *
94
- * // ❌ Throws with custom function message + case formatting
95
- * assertIsBoolean(123n, {
96
- * message: ({ currentType, validType }) =>
97
- * `Expected ${validType} but got (${currentType}).`,
98
- * formatCase: "toKebabCase"
99
- * });
100
- * // ➔ TypeError: "Expected boolean but got (big-int)."
101
- * ```
102
- *
103
- * -------------------------------------------------------
104
- * ✅ ***Real-world usage example***:
105
- * ```ts
106
- * type User = { name: string; email: string };
107
- *
108
- * const mixedValue: string | User | boolean | number | undefined = getUserInput();
109
- *
110
- * // ❌ Throws if not boolean
111
- * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
112
- * assertIsBoolean(mixedValue, { message: "Must be boolean!" });
113
- *
114
- * // ✅ After this call, TypeScript knows `mixedValue` is boolean
115
- * const result: boolean = mixedValue; // ➔ Safe to use
116
- * ```
117
- */
118
- declare const assertIsBoolean:(value:unknown,options?:AssertIsOptions)=>asserts value is boolean;
31
+ * * ***Custom error message for assertion failures.***
32
+ * -------------------------------------------------------
33
+ *
34
+ * @description
35
+ * This option allows overriding the **default error message** when a value
36
+ * does not match the required type.
37
+ *
38
+ * - If a **string** is provided:
39
+ * - Must be non-empty after trimming.
40
+ * - Will be used directly as the error message.
41
+ *
42
+ * - If a **function** is provided:
43
+ * - Receives an object containing:
44
+ * - `currentType` ➔ the detected runtime type of the value (depends `formatCase` options, e.g., `"number"`).
45
+ * - `validType` ➔ the expected type name (with format `kebab-case`, e.g., `"boolean"`, `"big-int"`, `"plain-object"`).
46
+ * - Must return a string. If the returned string is empty or whitespace,
47
+ * the default message will be used instead.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * // Static message
52
+ * { message: "Must be a boolean!" }
53
+ *
54
+ * // Dynamic message
55
+ * {
56
+ * message: ({ currentType, validType }) =>
57
+ * `Expected ${validType} but got ${currentType}`
58
+ * }
59
+ * ```
60
+ */
61
+ message?:string|(({currentType,validType}:OptionsMessageFunctionAssertIs)=>string);}& GetPreciseTypeOptions;
119
62
  /** -------------------------------------------------------
120
- * * ***Asserts that a value is of type `bigint`.***
121
- * -------------------------------------------------------
122
- * Validates that the given `value` is a **bigint**.
123
- *
124
- * - If `value` is a bigint execution continues normally.
125
- * - ❌ If `value` is not a bigint → throws a `TypeError` with either:
126
- * - A custom error message (`options.message`), or
127
- * - A default message including the actual type.
128
- *
129
- * This function is an **assertion function**.
130
- * After it returns successfully, TypeScript narrows the type of `value` to `bigint`.
131
- *
132
- * ℹ️ Note:
133
- * - A `bigint` refers strictly to the JavaScript `bigint` primitive type
134
- * (e.g., `123n`, `0n`, `-999999999999999999999n`).
135
- * - This excludes `BigInt` objects created with `Object(BigInt(123))`.
136
- *
137
- * @param value - The value to validate.
138
- * @param options - Optional configuration:
139
- * - `message`: A custom error message (string or function).
140
- * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
141
- *
142
- * @returns {asserts value is bigint} Narrows `value` to `bigint` if no error is thrown.
143
- * @throws {TypeError} If the value is not a bigint.
144
- *
145
- * @example
146
- * ```ts
147
- * // Simple usage
148
- * assertIsBigInt(123n);
149
- * // No error, value is bigint
150
- *
151
- * // ❌ Throws TypeError with default message
152
- * assertIsBigInt(42);
153
- * // TypeError: "Parameter input (`value`) must be of type `bigint`, but received: `number`."
154
- *
155
- * // ❌ Throws with custom string message
156
- * assertIsBigInt("123", { message: "Must be a bigint!" });
157
- * // ➔ TypeError: "Must be a bigint!"
158
- *
159
- * // Throws with custom function message + case formatting
160
- * assertIsBigInt(42, {
161
- * message: ({ currentType, validType }) =>
162
- * `Expected ${validType} but got (${currentType}).`,
163
- * formatCase: "toKebabCase"
164
- * });
165
- * // TypeError: "Expected bigint but got (number)."
166
- * ```
167
- *
168
- * -------------------------------------------------------
169
- * ***Real-world usage example***:
170
- * ```ts
171
- * const mixedValue: string | bigint | undefined = getUserInput();
172
- *
173
- * // ❌ Throws if not bigint
174
- * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
175
- * assertIsBigInt(mixedValue, { message: "Must be a bigint!" });
176
- *
177
- * // ✅ After this call, TypeScript knows `mixedValue` is bigint
178
- * const result: bigint = mixedValue; // ➔ Safe to use
179
- * console.log(result + 100n);
180
- * ```
181
- */
182
- declare const assertIsBigInt:(value:unknown,options?:AssertIsOptions)=>asserts value is bigint;type AssertIsNumberOptions=AssertIsOptions & IsNumberOptions;
63
+ * * ***Type guard assertion: `assertIsBoolean`.***
64
+ * -------------------------------------------------------
65
+ * **This function is an **assertion function**.**
66
+ * - Validates that the given `value` is a **boolean**.
67
+ * - After it returns successfully, TypeScript narrows the type of `value` to `boolean`.
68
+ * - **Behavior:**
69
+ * - If `value` is a `boolean` ➔ execution continues normally.
70
+ * - If `value` is not a `boolean` ➔ throws a `TypeError` with either:
71
+ * - A custom error message (`options.message`), or
72
+ * - A default message including the actual type.
73
+ * @param {*} value - The value to validate.
74
+ * @param {OptionsAssertIs} [options] - Optional configuration:
75
+ * - `message`: A custom error message (`string` or `function`).
76
+ * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
77
+ * @returns {boolean} Narrows `value` to `boolean` if no error is thrown.
78
+ * @throws {TypeError} If the value is not a boolean.
79
+ * @example
80
+ * ```ts
81
+ * // Simple usage
82
+ * assertIsBoolean(true);
83
+ * // No error, value is boolean
84
+ *
85
+ * // Throws TypeError with default message
86
+ * assertIsBoolean(42);
87
+ * // ➔ TypeError: "Parameter input (`value`) must be of type `boolean`, but received: `number`."
88
+ *
89
+ * // ❌ Throws with custom string message
90
+ * assertIsBoolean(42, { message: "Must be boolean!" });
91
+ * // ➔ TypeError: "Must be boolean!"
92
+ *
93
+ * // ❌ Throws with custom function message + case formatting
94
+ * assertIsBoolean(123n, {
95
+ * message: ({ currentType, validType }) =>
96
+ * `Expected ${validType} but got (${currentType}).`,
97
+ * formatCase: "toKebabCase"
98
+ * });
99
+ * // TypeError: "Expected boolean but got (big-int)."
100
+ * ```
101
+ * -------------------------------------------------------
102
+ * ***Real-world usage example***:
103
+ * ```ts
104
+ * type User = { name: string; email: string };
105
+ * const mixedValue: string | User | boolean | number | undefined = getUserInput();
106
+ *
107
+ * // ❌ Throws if not boolean
108
+ * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
109
+ * assertIsBoolean(mixedValue, { message: "Must be boolean!" });
110
+ *
111
+ * // ✅ After this call, TypeScript knows `mixedValue` is boolean
112
+ * const result: boolean = mixedValue; // ➔ Safe to use
113
+ * ```
114
+ */
115
+ declare const assertIsBoolean:(value:unknown,options?:OptionsAssertIs)=>asserts value is boolean;
183
116
  /** -------------------------------------------------------
184
- * * ***Asserts that a value is of type `number`.***
185
- * -------------------------------------------------------
186
- * Validates that the given `value` is a **number**.
187
- *
188
- * - If `value` is a number execution continues normally.
189
- * - ❌ If `value` is not a number → throws a `TypeError` with either:
190
- * - A custom error message (`options.message`), or
191
- * - A default message including the actual type.
192
- *
193
- * This function is an **assertion function**.
194
- * After it returns successfully, TypeScript narrows the type of `value` to `number`.
195
- *
196
- * ℹ️ Notes:
197
- * - A `number` refers strictly to the JavaScript `number` primitive type
198
- * (e.g., `42`, `3.14`, `-1`, `0`).
199
- * - This excludes `Number` objects created with `new Number(123)`.
200
- * - By default, `NaN` is **not considered** valid.
201
- * You can allow it with `{ includeNaN: true }`.
202
- *
203
- * @param value - The value to validate.
204
- * @param options - Optional configuration:
205
- * - `message`: A custom error message (string or function).
206
- * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
207
- * - `includeNaN`: Whether to treat `NaN` as valid.
208
- *
209
- * @returns {asserts value is number} Narrows `value` to `number` if no error is thrown.
210
- * @throws {TypeError} If the value is not a number (or is `NaN` when `includeNaN` is `false`).
211
- *
212
- * @example
213
- * ```ts
214
- * // Simple usage
215
- * assertIsNumber(123);
216
- * // No error, value is number
217
- *
218
- * // ❌ Throws TypeError with default message
219
- * assertIsNumber("42");
220
- * // TypeError: "Parameter input (`value`) must be of type `number`, but received: `string`."
221
- *
222
- * // ❌ Throws with custom string message
223
- * assertIsNumber(true, { message: "Must be a number!" });
224
- * // ➔ TypeError: "Must be a number!"
225
- *
226
- * // Throws with custom function message + case formatting
227
- * assertIsNumber("hello", {
228
- * message: ({ currentType, validType }) =>
229
- * `Expected ${validType} but got (${currentType}).`,
230
- * formatCase: "toKebabCase"
231
- * });
232
- * // TypeError: "Expected number but got (string)."
233
- *
234
- * // ⚠️ NaN is invalid by default
235
- * assertIsNumber(NaN);
236
- * // TypeError: "Parameter input (`value`) must be of type `number`, but received: `NaN`."
237
- *
238
- * // ✅ Allow NaN explicitly
239
- * assertIsNumber(NaN, { includeNaN: true });
240
- * // No error
241
- * ```
242
- *
243
- * -------------------------------------------------------
244
- * ✅ ***Real-world usage example***:
245
- * ```ts
246
- * const mixedValue: string | number | undefined = getUserInput();
247
- *
248
- * // ❌ Throws if not number
249
- * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
250
- * assertIsNumber(mixedValue, { message: "Must be a number!" });
251
- *
252
- * // ✅ After this call, TypeScript knows `mixedValue` is number
253
- * const result: number = mixedValue; // ➔ Safe to use
254
- * console.log(result + 100);
255
- * ```
256
- */
257
- declare const assertIsNumber:(value:unknown,options?:AssertIsNumberOptions)=>asserts value is number;
117
+ * * ***Type guard assertion: `assertIsBigInt`.***
118
+ * -------------------------------------------------------
119
+ * **This function is an **assertion function**.**
120
+ * - Validates that the given `value` is a **bigint**.
121
+ * - After it returns successfully, TypeScript narrows the type of `value` to `bigint`.
122
+ * - **Behavior:**
123
+ * - If `value` is a `bigint` ➔ execution continues normally.
124
+ * - If `value` is not a `bigint` ➔ throws a `TypeError` with either:
125
+ * - A custom error message (`options.message`), or
126
+ * - A default message including the actual type.
127
+ * - **ℹ️ Note:**
128
+ * - A `bigint` refers strictly to the JavaScript `bigint` primitive type (e.g., `123n`, `0n`, `-999999999999999999999n`).
129
+ * - This excludes `BigInt` objects created with `Object(BigInt(123))`.
130
+ * @param {*} value - The value to validate.
131
+ * @param {OptionsAssertIs} [options] - Optional configuration:
132
+ * - `message`: A custom error message (`string` or `function`).
133
+ * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
134
+ * @returns {boolean} Narrows `value` to `bigint` if no error is thrown.
135
+ * @throws {TypeError} If the value is not a bigint.
136
+ * @example
137
+ * ```ts
138
+ * // Simple usage
139
+ * assertIsBigInt(123n);
140
+ * // No error, value is bigint
141
+ *
142
+ * // Throws TypeError with default message
143
+ * assertIsBigInt(42);
144
+ * // ➔ TypeError: "Parameter input (`value`) must be of type `bigint`, but received: `number`."
145
+ *
146
+ * // ❌ Throws with custom string message
147
+ * assertIsBigInt("123", { message: "Must be a bigint!" });
148
+ * // ➔ TypeError: "Must be a bigint!"
149
+ *
150
+ * // ❌ Throws with custom function message + case formatting
151
+ * assertIsBigInt(42, {
152
+ * message: ({ currentType, validType }) =>
153
+ * `Expected ${validType} but got (${currentType}).`,
154
+ * formatCase: "toKebabCase"
155
+ * });
156
+ * // TypeError: "Expected bigint but got (number)."
157
+ * ```
158
+ * -------------------------------------------------------
159
+ * ***Real-world usage example***:
160
+ * ```ts
161
+ * const mixedValue: string | bigint | undefined = getUserInput();
162
+ *
163
+ * // ❌ Throws if not bigint
164
+ * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
165
+ * assertIsBigInt(mixedValue, { message: "Must be a bigint!" });
166
+ *
167
+ * // After this call, TypeScript knows `mixedValue` is bigint
168
+ * const result: bigint = mixedValue; // ➔ Safe to use
169
+ * console.log(result + 100n);
170
+ * ```
171
+ */
172
+ declare const assertIsBigInt:(value:unknown,options?:OptionsAssertIs)=>asserts value is bigint;type OptionsAssertIsNumber=OptionsAssertIs & IsNumberOptions;
258
173
  /** -------------------------------------------------------
259
- * * ***Asserts that a value is of type `array`.***
260
- * -------------------------------------------------------
261
- * Validates that the given `value` is an **array**.
262
- *
263
- * - If `value` is an array execution continues normally.
264
- * - ❌ If `value` is not an array → throws a `TypeError` with either:
265
- * - A custom error message (`options.message`), or
266
- * - A default message including the actual type.
267
- *
268
- * This function is an **assertion function**.
269
- * After it returns successfully, TypeScript narrows the type of `value`
270
- * to `AssertIsArrayResult<T>`.
271
- *
272
- * @template T - The input type being asserted.
273
- *
274
- * @param value - The value to validate.
275
- * @param options - Optional configuration:
276
- * - `message`: A custom error message (string or function).
277
- * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
278
- *
279
- * @returns {asserts value is AssertIsArrayResult<T>} Narrows `value` to an array if no error is thrown.
280
- * @throws {TypeError} If the value is not an array.
281
- *
282
- * @example
283
- * ```ts
284
- * // Simple usage
285
- * assertIsArray([1, 2, 3]);
286
- * // No error, value is array
287
- *
288
- * // Throws TypeError with default message
289
- * assertIsArray({ a: 1 });
290
- * // TypeError: "Parameter input (`value`) must be of type `array`, but received: `plain-object`."
291
- *
292
- * // Throws with custom string message
293
- * assertIsArray(42, { message: "Must be an array!" });
294
- * // TypeError: "Must be an array!"
295
- *
296
- * // Throws with custom function message + case formatting
297
- * assertIsArray(42n, {
298
- * message: ({ currentType, validType }) =>
299
- * `Expected ${validType} but got (${currentType}).`,
300
- * formatCase: "toKebabCase"
301
- * });
302
- * // TypeError: "Expected array but got (big-int)."
303
- * ```
304
- *
305
- * -------------------------------------------------------
306
- * ✅ ***Real-world usage with generic narrowing***:
307
- * ```ts
308
- * const mixedValue: string | number[] | undefined = getUserInput();
309
- *
310
- * // ❌ Throws if not array
311
- * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
312
- * assertIsArray(mixedValue, { message: "Must be an array!" });
313
- *
314
- * // After this call, TypeScript knows `mixedValue` is narrowed to number[]
315
- * const result: number[] = mixedValue; // ➔ Safe to use
316
- * console.log(result.length);
317
- * ```
318
- */
319
- declare function assertIsArray<T extends unknown[]>(value:T,options?:AssertIsOptions):value is Extract<T,unknown[]>;declare function assertIsArray<T extends readonly unknown[]>(value:T,options?:AssertIsOptions):value is Extract<T,readonly unknown[]>;declare function assertIsArray(value:unknown,options?:AssertIsOptions):value is unknown[];
174
+ * * ***Type guard assertion: `assertIsNumber`.***
175
+ * -------------------------------------------------------
176
+ * **This function is an **assertion function**.**
177
+ * - Validates that the given `value` is a **number**.
178
+ * - After it returns successfully, TypeScript narrows the type of `value` to `number`.
179
+ * - **Behavior:**
180
+ * - If `value` is a `number` ➔ execution continues normally.
181
+ * - If `value` is not a `number` ➔ throws a `TypeError` with either:
182
+ * - A custom error message (`options.message`), or
183
+ * - A default message including the actual type.
184
+ * - **ℹ️ Note:**
185
+ * - A `number` refers strictly to the JavaScript `number` primitive type (e.g., `42`, `3.14`, `-1`, `0`).
186
+ * - This excludes `Number` objects created with `new Number(123)`.
187
+ * - By default, `NaN` is **not considered** valid, you can allow it with `{ includeNaN: true }`.
188
+ * @param {*} value - The value to validate.
189
+ * @param {OptionsAssertIsNumber} [options] - Optional configuration:
190
+ * - `message`: A custom error message (`string` or `function`).
191
+ * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
192
+ * - `includeNaN`: Whether to treat `NaN` as valid.
193
+ * @returns {boolean} Narrows `value` to `number` if no error is thrown.
194
+ * @throws {TypeError} If the value is not a number (or is `NaN` when `includeNaN` is `false`).
195
+ * @example
196
+ * ```ts
197
+ * // ✅ Simple usage
198
+ * assertIsNumber(123);
199
+ * // No error, value is number
200
+ *
201
+ * // Throws TypeError with default message
202
+ * assertIsNumber("42");
203
+ * // TypeError: "Parameter input (`value`) must be of type `number`, but received: `string`."
204
+ *
205
+ * // Throws with custom string message
206
+ * assertIsNumber(true, { message: "Must be a number!" });
207
+ * // TypeError: "Must be a number!"
208
+ *
209
+ * // Throws with custom function message + case formatting
210
+ * assertIsNumber("hello", {
211
+ * message: ({ currentType, validType }) =>
212
+ * `Expected ${validType} but got (${currentType}).`,
213
+ * formatCase: "toKebabCase"
214
+ * });
215
+ * // ➔ TypeError: "Expected number but got (string)."
216
+ *
217
+ * // ⚠️ NaN is invalid by default
218
+ * assertIsNumber(NaN);
219
+ * // ➔ TypeError: "Parameter input (`value`) must be of type `number`, but received: `NaN`."
220
+ *
221
+ * // Allow NaN explicitly
222
+ * assertIsNumber(NaN, { includeNaN: true });
223
+ * // No error
224
+ * ```
225
+ *
226
+ * -------------------------------------------------------
227
+ * ***Real-world usage example***:
228
+ * ```ts
229
+ * const mixedValue: string | number | undefined = getUserInput();
230
+ *
231
+ * // ❌ Throws if not number
232
+ * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
233
+ * assertIsNumber(mixedValue, { message: "Must be a number!" });
234
+ *
235
+ * // ✅ After this call, TypeScript knows `mixedValue` is number
236
+ * const result: number = mixedValue; // ➔ Safe to use
237
+ * console.log(result + 100);
238
+ * ```
239
+ */
240
+ declare const assertIsNumber:(value:unknown,options?:OptionsAssertIsNumber)=>asserts value is number;
320
241
  /** -------------------------------------------------------
321
- * * ***Asserts that a value is a plain object.***
322
- * -------------------------------------------------------
323
- * Ensures that the given `value` is a **plain object**.
324
- * - Throws a `TypeError` if the value is **not a plain object**.
325
- *
326
- * @template T - The input type being asserted.
327
- * After assertion, TypeScript will refine `value` to `IsPlainObjectResult<T>`.
328
- *
329
- * @param {T} value - The value to check.
330
- * @param {AssertIsOptions} [options] - Optional configuration, such as:
331
- * - Custom error message (`string` or `(info) => string`)
332
- * - Message formatting (`formatCase`)
333
- * - Expected `validType` description override
334
- * @throws {TypeError} If `value` is not a plain object (with either a default or custom message).
335
- *
336
- * @example
337
- * ```ts
338
- * // ✅ Simple usage
339
- * assertIsPlainObject({ a: 1, b: 2 });
340
- * // ok, value is plain object
341
- *
342
- * // Throws TypeError with default message
343
- * assertIsPlainObject([1, 2, 3]);
344
- * // TypeError: "Parameter input (`value`) must be of type `plain-object`, but received: `array`."
345
- *
346
- * // Throws with custom string message
347
- * assertIsPlainObject("hello", { message: "Must be plain object!" });
348
- * // TypeError: "Must be plain object!"
349
- *
350
- * // Throws with custom message function and formatCase
351
- * assertIsPlainObject(42n, {
352
- * message: ({ currentType, validType }) =>
353
- * `Expected ${validType} but got (${currentType}).`,
354
- * formatCase: "toKebabCase"
355
- * });
356
- * // ➔ TypeError: "Expected plain-object but got (big-int)."
357
- * ```
358
- * -------------------------------------------------------
359
- * ✅ ***Real-world usage with generic narrowing***:
360
- * ```ts
361
- * type User = { name: string; email: string };
362
- *
363
- * const mixedValue: string | User | boolean | number | undefined = getUserInput();
364
- *
365
- * // Throws TypeError if not plain object
366
- * assertIsPlainObject(mixedValue, { message: "Must be plain object!" });
367
- *
368
- * // After this call, TypeScript knows `mixedValue` is narrowed to User
369
- * const user: User = mixedValue; // ➔ safe
370
- * console.log(user.email); // type-safe
371
- * ```
372
- */
373
- declare function assertIsPlainObject<T>(value:T,options?:AssertIsOptions):asserts value is IsPlainObjectResult<T>;
242
+ * * ***Type guard assertion: `assertIsArray`.***
243
+ * -------------------------------------------------------
244
+ * **This function is an **assertion function**.**
245
+ * - Validates that the given `value` is a **array**.
246
+ * - After it returns successfully, TypeScript narrows the type of `value` to `array` **(generic support)**.
247
+ * - **Behavior:**
248
+ * - If `value` is an `array` execution continues normally.
249
+ * - ❌ If `value` is not an `array` ➔ throws a `TypeError` with either:
250
+ * - A custom error message (`options.message`), or
251
+ * - A default message including the actual type.
252
+ * @template T - The input type being asserted.
253
+ * @param {*} value - The value to validate.
254
+ * @param {OptionsAssertIs} [options] - Optional configuration:
255
+ * - `message`: A custom error message (`string` or `function`).
256
+ * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
257
+ * @returns {boolean} Narrows `value` to an `array` **(generic support)** if no error is thrown.
258
+ * @throws {TypeError} If the value is not an array.
259
+ * @example
260
+ * ```ts
261
+ * // Simple usage
262
+ * assertIsArray([1, 2, 3]);
263
+ * // No error, value is array
264
+ *
265
+ * // Throws TypeError with default message
266
+ * assertIsArray({ a: 1 });
267
+ * // TypeError: "Parameter input (`value`) must be of type `array`, but received: `plain-object`."
268
+ *
269
+ * // Throws with custom string message
270
+ * assertIsArray(42, { message: "Must be an array!" });
271
+ * // TypeError: "Must be an array!"
272
+ *
273
+ * // Throws with custom function message + case formatting
274
+ * assertIsArray(42n, {
275
+ * message: ({ currentType, validType }) =>
276
+ * `Expected ${validType} but got (${currentType}).`,
277
+ * formatCase: "toKebabCase"
278
+ * });
279
+ * // ➔ TypeError: "Expected array but got (big-int)."
280
+ * ```
281
+ *
282
+ * -------------------------------------------------------
283
+ * ✅ ***Real-world usage with generic narrowing***:
284
+ * ```ts
285
+ * const mixedValue: string | number[] | undefined = getUserInput();
286
+ *
287
+ * // Throws if not array
288
+ * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
289
+ * assertIsArray(mixedValue, { message: "Must be an array!" });
290
+ *
291
+ * // After this call, TypeScript knows `mixedValue` is narrowed to number[]
292
+ * const result: number[] = mixedValue; // ➔ Safe to use
293
+ * console.log(result.length);
294
+ * ```
295
+ */
296
+ declare function assertIsArray<T extends unknown[]>(value:T,options?:OptionsAssertIs):value is Extract<T,unknown[]>;declare function assertIsArray<T extends readonly unknown[]>(value:T,options?:OptionsAssertIs):value is Extract<T,readonly unknown[]>;declare function assertIsArray(value:unknown,options?:OptionsAssertIs):value is unknown[];
374
297
  /** -------------------------------------------------------
375
- * * ***Asserts that a value is a string.***
376
- * -------------------------------------------------------
377
- * Ensures that the given value is a **primitive string**.
378
- * - Throws a `TypeError` if the value is **not a string**.
379
- *
380
- * ℹ️ Note:
381
- * - A "string" refers strictly to a JavaScript primitive string type
382
- * (e.g., `"hello"`, `""`, `"123"`).
383
- * - This function excludes `String` objects created with `new String()`.
384
- *
385
- * @param {unknown} value - The value to check.
386
- * @param {AssertIsOptions} [options] - Optional configuration including custom error message and formatting.
387
- * @returns {asserts value is string}
388
- * After this call, `value` is guaranteed to be a **primitive string**.
389
- * @throws {TypeError} If the value is not a string.
390
- *
391
- * @example
392
- * ```ts
393
- * // ✅ Simple usage
394
- * assertIsString("hello");
395
- * // ok value is string, no error
396
- *
397
- * // ❌ Throws TypeError with default message
398
- * assertIsString(42);
399
- * // TypeError: "Parameter input (`value`) must be of type `string`, but received: `number`."
400
- *
401
- * // ❌ Throws with custom string message
402
- * assertIsString(42, { message: "Must be a string!" });
403
- * // TypeError: "Must be a string!"
404
- *
405
- * // ❌ Throws with custom message function and formatCase
406
- * assertIsString(42n, {
407
- * message: ({ currentType, validType }) => `Expected ${currentType} but got (${currentType}).`,
408
- * formatCase: "toKebabCase"
409
- * });
410
- * // ➔ TypeError: "Expected string but got (big-int)."
411
- * ```
412
- * -------------------------------------------------------
413
- * ✅ ***Real-world usage with generic narrowing***:
414
- * ```ts
415
- * type User = { name: string; email: string };
416
- *
417
- * const mixedValue: string | User | undefined = getUserInput();
418
- *
419
- * // Throws TypeError if the value is not string
420
- * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
421
- * assertIsString(mixedValue, { message: "Must be a string!" });
422
- *
423
- * // After this call, TypeScript knows `mixedValue` is string
424
- * const result: string = mixedValue; // ➔ safe to use
425
- * console.log(result.toUpperCase()); // ➔ type-safe
426
- * ```
427
- */
428
- declare const assertIsString:(value:unknown,options?:AssertIsOptions)=>asserts value is string;export{assertIsArray,assertIsBigInt,assertIsBoolean,assertIsNumber,assertIsPlainObject,assertIsString};
298
+ * * ***Type guard assertion: `assertIsPlainObject`.***
299
+ * -------------------------------------------------------
300
+ * **This function is an **assertion function**.**
301
+ * - Validates that the given `value` is a **plain-object**.
302
+ * - After it returns successfully, TypeScript narrows the type of `value` to `plain-object` **(generic support)**.
303
+ * - **Behavior:**
304
+ * - If `value` is a `plain-object` execution continues normally.
305
+ * - ❌ If `value` is not a `plain-object` ➔ throws a `TypeError` with either:
306
+ * - A custom error message (`options.message`), or
307
+ * - A default message including the actual type.
308
+ * @template T - The input type being asserted.
309
+ * @param {*} value - The value to validate.
310
+ * @param {OptionsAssertIs} [options] - Optional configuration:
311
+ * - `message`: A custom error message (`string` or `function`).
312
+ * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
313
+ * @returns {boolean} Narrows `value` to a `plain-object` **(generic support)** if no error is thrown.
314
+ * @throws {TypeError} If `value` is not a `plain-object`.
315
+ * @example
316
+ * ```ts
317
+ * // ✅ Simple usage
318
+ * assertIsPlainObject({ a: 1, b: 2 });
319
+ * // ➔ ok, value is plain object
320
+ *
321
+ * // ❌ Throws TypeError with default message
322
+ * assertIsPlainObject([1, 2, 3]);
323
+ * // ➔ TypeError: "Parameter input (`value`) must be of type `plain-object`, but received: `array`."
324
+ *
325
+ * // Throws with custom string message
326
+ * assertIsPlainObject("hello", { message: "Must be plain object!" });
327
+ * // ➔ TypeError: "Must be plain object!"
328
+ *
329
+ * // ❌ Throws with custom message function and formatCase
330
+ * assertIsPlainObject(42n, {
331
+ * message: ({ currentType, validType }) =>
332
+ * `Expected ${validType} but got (${currentType}).`,
333
+ * formatCase: "toKebabCase"
334
+ * });
335
+ * // ➔ TypeError: "Expected plain-object but got (big-int)."
336
+ * ```
337
+ * -------------------------------------------------------
338
+ * ***Real-world usage with generic narrowing***:
339
+ * ```ts
340
+ * type User = { name: string; email: string };
341
+ * const mixedValue: string | User | boolean | number | undefined = getUserInput();
342
+ *
343
+ * // Throws TypeError if not plain object
344
+ * assertIsPlainObject(mixedValue, { message: "Must be plain object!" });
345
+ *
346
+ * // After this call, TypeScript knows `mixedValue` is narrowed to User
347
+ * const user: User = mixedValue; // ➔ safe
348
+ * console.log(user.email); // ➔ type-safe
349
+ * ```
350
+ */
351
+ declare function assertIsPlainObject<T>(value:T,options?:OptionsAssertIs):asserts value is IsPlainObjectResult<T>;
352
+ /** -------------------------------------------------------
353
+ * * ***Type guard assertion: `assertIsString`.***
354
+ * -------------------------------------------------------
355
+ * **This function is an **assertion function**.**
356
+ * - Validates that the given `value` is a **primitive-string**.
357
+ * - After it returns successfully, TypeScript narrows the type of `value` to `primitive-string`.
358
+ * - **Behavior:**
359
+ * - ✅ If `value` is a `primitive-string` ➔ execution continues normally.
360
+ * - ❌ If `value` is not a `primitive-string` ➔ throws a `TypeError` with either:
361
+ * - A custom error message (`options.message`), or
362
+ * - A default message including the actual type.
363
+ * - **ℹ️ Note:**
364
+ * - A "string" refers strictly to a JavaScript `primitive-string` type (e.g., `"hello"`, `""`, `"123"`).
365
+ * - This function excludes `String` objects created with `new String()`.
366
+ * @param {*} value - The value to validate.
367
+ * @param {OptionsAssertIs} [options] - Optional configuration:
368
+ * - `message`: A custom error message (`string` or `function`).
369
+ * - `formatCase`: Controls type formatting (from `GetPreciseTypeOptions`).
370
+ * @returns {boolean} Narrows `value` to `string` if no error is thrown.
371
+ * @throws {TypeError} If the value is not a string.
372
+ * @example
373
+ * ```ts
374
+ * // ✅ Simple usage
375
+ * assertIsString("hello");
376
+ * // ➔ ✅ ok value is string, no error
377
+ *
378
+ * // ❌ Throws TypeError with default message
379
+ * assertIsString(42);
380
+ * // ➔ TypeError: "Parameter input (`value`) must be of type `string`, but received: `number`."
381
+ *
382
+ * // ❌ Throws with custom string message
383
+ * assertIsString(42, { message: "Must be a string!" });
384
+ * // ➔ TypeError: "Must be a string!"
385
+ *
386
+ * // ❌ Throws with custom message function and formatCase
387
+ * assertIsString(42n, {
388
+ * message: ({ currentType, validType }) => `Expected ${currentType} but got (${currentType}).`,
389
+ * formatCase: "toKebabCase"
390
+ * });
391
+ * // ➔ TypeError: "Expected string but got (big-int)."
392
+ * ```
393
+ * -------------------------------------------------------
394
+ * ✅ ***Real-world usage with generic narrowing***:
395
+ * ```ts
396
+ * type User = { name: string; email: string };
397
+ * const mixedValue: string | User | undefined = getUserInput();
398
+ *
399
+ * // Throws TypeError if the value is not string
400
+ * // ⚠️ Code below after this call, will NOT be executed if TypeError is thrown
401
+ * assertIsString(mixedValue, { message: "Must be a string!" });
402
+ *
403
+ * // After this call, TypeScript knows `mixedValue` is string
404
+ * const result: string = mixedValue; // ➔ ✅ safe to use
405
+ * console.log(result.toUpperCase()); // ➔ ✅ type-safe
406
+ * ```
407
+ */
408
+ declare const assertIsString:(value:unknown,options?:OptionsAssertIs)=>asserts value is string;export{assertIsArray,assertIsBigInt,assertIsBoolean,assertIsNumber,assertIsPlainObject,assertIsString};