xenopomp-essentials 0.3.2 → 0.3.4-hotfix.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 (142) hide show
  1. package/cli-tools/index.d.mts +60 -0
  2. package/cli-tools/index.d.ts +60 -0
  3. package/cli-tools/index.mjs +1 -0
  4. package/eslint/index.d.mts +39 -0
  5. package/eslint/index.d.ts +39 -0
  6. package/eslint/index.mjs +3 -0
  7. package/index.d.mts +613 -0
  8. package/index.d.ts +613 -0
  9. package/index.mjs +1 -0
  10. package/next/index.d.mts +67 -0
  11. package/next/index.d.ts +67 -0
  12. package/next/index.mjs +11 -0
  13. package/package.json +4 -1
  14. package/.config/.lintstagedrc.json +0 -3
  15. package/.config/build.config.ts +0 -41
  16. package/.config/testing-exclusions/index.ts +0 -2
  17. package/.config/testing-exclusions/istanbul-exclusions.ts +0 -1
  18. package/.config/testing-exclusions/vitest-exclusions.ts +0 -8
  19. package/.config/ts/tsconfig.lint.json +0 -10
  20. package/.config/vitest.config.ts +0 -18
  21. package/.gitattributes +0 -25
  22. package/.github/workflows/ci.yml +0 -54
  23. package/.github/workflows/npm-publish.yml +0 -27
  24. package/.husky/pre-commit +0 -1
  25. package/.idea/codeStyles/Project.xml +0 -59
  26. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  27. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  28. package/.idea/modules.xml +0 -8
  29. package/.idea/prettier.xml +0 -7
  30. package/.idea/runConfigurations/_template__of_Vitest.xml +0 -9
  31. package/.idea/runConfigurations/build.xml +0 -13
  32. package/.idea/runConfigurations/coverage.xml +0 -12
  33. package/.idea/runConfigurations/lint.xml +0 -13
  34. package/.idea/runConfigurations/lint_code.xml +0 -13
  35. package/.idea/vcs.xml +0 -6
  36. package/.idea/xenopomp-essentials-js.iml +0 -14
  37. package/.prettierrc +0 -20
  38. package/README.md +0 -0
  39. package/__tests__/assets/assertions/expect-deep-equal.ts +0 -14
  40. package/__tests__/assets/assertions/expect-to-render.ts +0 -26
  41. package/__tests__/assets/assertions/index.ts +0 -3
  42. package/__tests__/assets/assertions/not-throwing.ts +0 -6
  43. package/__tests__/assets/index.ts +0 -1
  44. package/__tests__/data/index.ts +0 -1
  45. package/__tests__/data/parseVersion.data.ts +0 -52
  46. package/__tests__/unit/cli/path-builder.test.ts +0 -39
  47. package/__tests__/unit/components/hoc/jsx-dot-notation/component.test-source.tsx +0 -24
  48. package/__tests__/unit/components/hoc/jsx-dot-notation/hoc.test.tsx +0 -11
  49. package/__tests__/unit/components/metrika.test.tsx +0 -14
  50. package/__tests__/unit/components/react-scan.test.tsx +0 -10
  51. package/__tests__/unit/eslint/config.test.tsx +0 -41
  52. package/__tests__/unit/utils/capitalize.test.ts +0 -17
  53. package/__tests__/unit/utils/minmax.test.ts +0 -21
  54. package/__tests__/unit/utils/parseVersion.test.ts +0 -22
  55. package/__tests__/unit/utils/pipe.test.ts +0 -23
  56. package/__tests__/unit/utils/transliterate.test.ts +0 -17
  57. package/_templates/generator/help/index.ejs.t +0 -5
  58. package/_templates/generator/new/hello.ejs.t +0 -18
  59. package/_templates/generator/with-prompt/hello.ejs.t +0 -18
  60. package/_templates/generator/with-prompt/prompt.ejs.t +0 -14
  61. package/_templates/init/repo/new-repo.ejs.t +0 -4
  62. package/_templates/type/new/module.ejs.t +0 -7
  63. package/_templates/type/new/type.ejs.t +0 -7
  64. package/_templates/util/new/func.ejs.t +0 -7
  65. package/_templates/util/new/module.ejs.t +0 -7
  66. package/_templates/util/new/test.ejs.t +0 -13
  67. package/eslint.config.ts +0 -17
  68. package/src/cli-tools/changeFile.ts +0 -1
  69. package/src/cli-tools/index.ts +0 -2
  70. package/src/cli-tools/pathBuilder.ts +0 -89
  71. package/src/eslint/config.ts +0 -145
  72. package/src/eslint/configs/all.ts +0 -74
  73. package/src/eslint/configs/deprecation.ts +0 -33
  74. package/src/eslint/configs/index.ts +0 -7
  75. package/src/eslint/configs/markdown.ts +0 -30
  76. package/src/eslint/configs/next.ts +0 -40
  77. package/src/eslint/configs/old.ts +0 -67
  78. package/src/eslint/configs/prettier.ts +0 -6
  79. package/src/eslint/configs/react.ts +0 -18
  80. package/src/eslint/index.ts +0 -7
  81. package/src/eslint/prefixes/author.ts +0 -2
  82. package/src/eslint/prefixes/index.ts +0 -1
  83. package/src/eslint/types/configs.ts +0 -4
  84. package/src/eslint/types/custom-config.ts +0 -4
  85. package/src/eslint/types/index.ts +0 -2
  86. package/src/index.ts +0 -3
  87. package/src/next/Metrika/Metrika.props.ts +0 -11
  88. package/src/next/Metrika/Metrika.tsx +0 -56
  89. package/src/next/ReactScan/ReactScan.tsx +0 -33
  90. package/src/next/index.ts +0 -2
  91. package/src/react/hoc/index.ts +0 -1
  92. package/src/react/hoc/jsxDotNotation.tsx +0 -38
  93. package/src/react/index.ts +0 -1
  94. package/src/repo-eslint-rules/deep-type-naming.rule.ts +0 -49
  95. package/src/repo-eslint-rules/index.ts +0 -9
  96. package/src/schemas/import-meta.schema.ts +0 -12
  97. package/src/schemas/index.ts +0 -1
  98. package/src/types/aliases/AnyObject.ts +0 -5
  99. package/src/types/aliases/EmptyObject.ts +0 -8
  100. package/src/types/aliases/Fn.ts +0 -12
  101. package/src/types/aliases/index.ts +0 -3
  102. package/src/types/index.ts +0 -4
  103. package/src/types/next/NextParams.ts +0 -26
  104. package/src/types/next/index.ts +0 -1
  105. package/src/types/react/AnyFc.ts +0 -6
  106. package/src/types/react/AsyncFC.ts +0 -16
  107. package/src/types/react/DataAttributes.ts +0 -21
  108. package/src/types/react/FCProps.ts +0 -19
  109. package/src/types/react/FunctionalChildren.ts +0 -13
  110. package/src/types/react/SetState.ts +0 -11
  111. package/src/types/react/VariableFC.ts +0 -48
  112. package/src/types/react/VariableProps.ts +0 -9
  113. package/src/types/react/index.ts +0 -8
  114. package/src/types/utilities/ArrayType.ts +0 -12
  115. package/src/types/utilities/AsyncReturnType.ts +0 -14
  116. package/src/types/utilities/DeepInject.ts +0 -22
  117. package/src/types/utilities/Defined.ts +0 -5
  118. package/src/types/utilities/Jsonish.ts +0 -11
  119. package/src/types/utilities/LenientAutocomplete.ts +0 -24
  120. package/src/types/utilities/MatchType.ts +0 -26
  121. package/src/types/utilities/MergeTypes.ts +0 -12
  122. package/src/types/utilities/Modify.ts +0 -10
  123. package/src/types/utilities/Nullable.ts +0 -5
  124. package/src/types/utilities/OneOf.ts +0 -42
  125. package/src/types/utilities/Prettify.ts +0 -15
  126. package/src/types/utilities/RecordKey.ts +0 -9
  127. package/src/types/utilities/RecordValue.ts +0 -9
  128. package/src/types/utilities/ReplaceReturnType.ts +0 -10
  129. package/src/types/utilities/SelectivePartial.ts +0 -17
  130. package/src/types/utilities/StrictOmit.ts +0 -19
  131. package/src/types/utilities/Synchronous.ts +0 -18
  132. package/src/types/utilities/Undefinable.ts +0 -5
  133. package/src/types/utilities/WeakOmit.ts +0 -17
  134. package/src/types/utilities/Writeable.ts +0 -18
  135. package/src/types/utilities/index.ts +0 -24
  136. package/src/utils/capitalize.ts +0 -15
  137. package/src/utils/index.ts +0 -7
  138. package/src/utils/minmax.ts +0 -35
  139. package/src/utils/parseVersion.ts +0 -42
  140. package/src/utils/pipe.ts +0 -29
  141. package/src/utils/transliterate.ts +0 -8
  142. package/tsconfig.json +0 -43
package/index.d.mts ADDED
@@ -0,0 +1,613 @@
1
+ import { ElementType, ComponentProps, FC, ReactNode, Dispatch, SetStateAction } from 'react';
2
+ import { Jsonifiable } from 'type-fest';
3
+ import * as transliteration from 'transliteration';
4
+
5
+ /**
6
+ * Matches any object but not arrays, class instances etc.
7
+ * @since 0.0.1
8
+ */
9
+ type AnyObject = Record<PropertyKey, unknown>;
10
+
11
+ /**
12
+ * This type stands for empty object type.
13
+ *
14
+ * @since 0.0.1
15
+ * @example
16
+ * const message: EmptyObject = { type: string; }; // Will cause error.
17
+ */
18
+ type EmptyObject = Record<PropertyKey, never>;
19
+
20
+ /**
21
+ * Simple alias for creating function types. You can use it for type guards
22
+ * as representation of any function, also you can create cleaner type declarations
23
+ * for functions.
24
+ *
25
+ * @since 0.0.1
26
+ * @example
27
+ * type MyFn = Fn<[a: string, b: string], string>;
28
+ */
29
+ type Fn<Args extends any[] = any[], Res = unknown> = (...args: Args) => Res;
30
+
31
+ type ParamObj<P extends string> = Record<P, string>;
32
+ /**
33
+ * Represents Next.js routing params.
34
+ * @since 0.0.1
35
+ */
36
+ interface NextParams<P extends string> {
37
+ params: ParamObj<P>;
38
+ }
39
+ /**
40
+ * Represents Next.js routing search params.
41
+ * @since 0.0.1
42
+ */
43
+ interface NextSearchParams<P extends string> {
44
+ searchParams: ParamObj<P>;
45
+ }
46
+ /**
47
+ * This type describes Next error page params.
48
+ * @since 0.0.1
49
+ */
50
+ interface NextErrorParams<E extends Error = any> {
51
+ error: E;
52
+ reset: () => void;
53
+ }
54
+
55
+ /**
56
+ * This type wraps ComponentProps<A> to your FC.
57
+ *
58
+ * - __A__ - element type
59
+ * - __P__ - wrapping props
60
+ * - __Ex__ - excluded component props (for example, if you do not want to include 'children' prop in component)
61
+ *
62
+ * @since 0.0.1
63
+ *
64
+ * @example
65
+ * type VariableComponentPropsWithChildren = ComponentProps<VariableFC<'div'>>;
66
+ * type VariableComponentPropsWithoutChildren = ComponentProps<VariableFC<'div', {}, 'children'>>;
67
+ *
68
+ * @example
69
+ * // With children
70
+ * const VariableComponent: VariableFC<'section', { variant?: 'default' }> = ({ variant, ...props }) => {
71
+ * return <section {...props}></section>
72
+ * }
73
+ *
74
+ * @example
75
+ * // Without children
76
+ * const VariableComponent: VariableFC<'section', { variant?: 'default' }, 'children'> = ({ variant, ...props }) => {
77
+ * return (
78
+ * <section {...props}>
79
+ * <div>Insert your own children</div>
80
+ * </section>
81
+ * );
82
+ * }
83
+ */
84
+ type VariableFC<A extends ElementType, P = unknown, Ex extends keyof ComponentProps<A> | undefined = undefined> = FC<P & WeakOmit<ComponentProps<A>, Ex>>;
85
+ /**
86
+ * Works similar to {@link VariableFC}, but return type is Promise<ReactNode>;
87
+ * @since 0.0.1
88
+ */
89
+ type AsyncVariableFC<A extends ElementType, P = unknown, Ex extends keyof ComponentProps<A> | undefined = undefined> = AsyncFC<P & WeakOmit<ComponentProps<A>, Ex>>;
90
+
91
+ /**
92
+ * Same as **FC** (or FunctionalComponent), but it returns Promise.
93
+ *
94
+ * @since 0.0.1
95
+ * @example
96
+ * const Header: AsyncFC<HeaderProps> = async ({}) => {
97
+ * // Do async stuff here...
98
+ *
99
+ * return <div></div>;
100
+ * };
101
+ */
102
+ type AsyncFC<T = unknown> = ReplaceReturnType<FC<T>, Promise<ReactNode>>;
103
+
104
+ /**
105
+ * Type of set state function from useState.
106
+ *
107
+ * @since 0.0.1
108
+ * @example
109
+ * // typeof setState => SetState<string>
110
+ * const [state, setState] = useState<string>('example');
111
+ */
112
+ type SetState<TType> = Dispatch<SetStateAction<TType>>;
113
+
114
+ /**
115
+ * This type allows you to make children that can be function.
116
+ *
117
+ * @since 0.0.1
118
+ * @example
119
+ * type Child = FunctionalChildren<[options: string]>;
120
+ * // ReactNode | ((options: string) => ReactNode)
121
+ */
122
+ type FunctionalChildren<Args extends any[]> = ReactNode | ((...args: Args) => ReactNode);
123
+
124
+ /**
125
+ * @deprecated use {@link FCProps} instead.
126
+ */
127
+ type FcProps<Comp> = FCProps<Comp>;
128
+ /**
129
+ * Extracts type of props from FC type.
130
+ *
131
+ * @since 0.0.1
132
+ * @example
133
+ * type Props = FcProps<FC<{ align?: boolean }>>;
134
+ * // ^? { align?: boolean }
135
+ *
136
+ * type VariableProps = FcProps<VariableFC<'button', { notAlign?: boolean }>>;
137
+ * // ^? {notAlign?: boolean} & Omit<ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement>, undefined>
138
+ */
139
+ type FCProps<Comp> = Comp extends FC<infer Props> ? Props : never;
140
+
141
+ /**
142
+ * Matches any proper React component.
143
+ */
144
+ type AnyFC = FC<unknown>;
145
+
146
+ /**
147
+ * Type that represents data-{attr} keys.
148
+ */
149
+ type Attribute = `data-${string}`;
150
+ /**
151
+ * Matches any proper data-{attr} keys.
152
+ */
153
+ type DataAttributeShape = Record<Attribute, any>;
154
+ /**
155
+ * Represents React`s data-{attr} properties for components.
156
+ *
157
+ * @example
158
+ * type AdditionalAttributes = DataAttributes<{ 'data-disabled': boolean }>;
159
+ *
160
+ * const attrs: AdditionalAttributes = {
161
+ * 'data-disabled': false, // this attr is required
162
+ * };
163
+ */
164
+ type DataAttributes<Shape extends DataAttributeShape> = Shape;
165
+
166
+ type VariableProps<A extends ElementType, P = unknown, Ex extends keyof ComponentProps<A> | undefined = undefined> = FCProps<VariableFC<A, P, Ex>>;
167
+
168
+ /**
169
+ * Make any async func synchronous.
170
+ *
171
+ * Return never, if __Func__ is not a function, actually.
172
+ *
173
+ * @since 0.0.1
174
+ * @example
175
+ * type NormalFunc = Synchronous<(one: string, two: number) => void>; // (one: string, two: number) => void
176
+ * type AsyncFunc = Synchronous<(one: string, two: number) => Promise<void>>; // (one: string, two: number) => void
177
+ * type NotAFunc = Synchronous<'sus'>; // never
178
+ */
179
+ type Synchronous<Func> = Func extends Fn ? Func extends (...args: any[]) => Promise<infer Result> ? ReplaceReturnType<Func, Result> : Func : never;
180
+
181
+ /**
182
+ * Removes readonly from type.
183
+ * @since 0.0.1
184
+ */
185
+ type Writeable<T> = {
186
+ -readonly [P in keyof T]: T[P];
187
+ };
188
+ /**
189
+ * @deprecated Use {@link WriteableDeep} instead.
190
+ */
191
+ type DeepWriteable<T> = WriteableDeep<T>;
192
+ /**
193
+ * Removes readonly from type deeply.
194
+ * @since 0.0.1
195
+ */
196
+ type WriteableDeep<T> = {
197
+ -readonly [P in keyof T]: DeepWriteable<T[P]>;
198
+ };
199
+
200
+ /**
201
+ * Checks if type **T** matches type **M**.
202
+ *
203
+ * @since 0.0.1
204
+ *
205
+ * @example Not matching
206
+ * type ViewStyles = {
207
+ * paddingHorizontal: number
208
+ * }
209
+ *
210
+ * type Styles = MatchType<{}, ViewStyles>; // TSERROR
211
+ *
212
+ * @example Matching
213
+ * type ViewStyles = {
214
+ * paddingHorizontal: number;
215
+ * };
216
+ *
217
+ * // No error
218
+ * type Styles = MatchType<
219
+ * {
220
+ * paddingHorizontal: number;
221
+ * },
222
+ * ViewStyles
223
+ * >;
224
+ */
225
+ type MatchType<T extends M, M> = T extends M ? T : never;
226
+
227
+ /**
228
+ * This type gets type of array`s item.
229
+ *
230
+ * @since 0.0.1
231
+ * @example
232
+ * type Super = ArrayType<string[]>; // string
233
+ *
234
+ * type Good = ArrayType<(string|number)[]>; // string | number
235
+ */
236
+ type ArrayType<T> = T extends Array<infer A> ? A : never;
237
+ type ArrayItemType<T> = ArrayType<T>;
238
+
239
+ /**
240
+ * Get return type of function that returns Promise ((...args: any) => Promise<any>).
241
+ *
242
+ * @since 0.0.1
243
+ * @example
244
+ * const doSomething = async (): Promise<string|number> => {
245
+ * return 'result';
246
+ * }
247
+ *
248
+ * type Something = PromiseReturnType<typeof doSomething>;
249
+ * // string|number
250
+ */
251
+ type AsyncReturnType<F extends (...args: any[]) => Promise<any>> = Awaited<ReturnType<F>>;
252
+
253
+ /**
254
+ * @deprecated Use {@link InjectDeep} instead.
255
+ */
256
+ type DeepInject<T, I extends AnyObject> = InjectDeep<T, I>;
257
+ /**
258
+ * Recursively add some type inside all keys of target type.
259
+ *
260
+ * @since 0.0.1
261
+ * @example
262
+ * type Sups = DeepInject<{ supa: { sups: number } }, { _ignore: boolean }>;
263
+ * const asp: Sups = { supa: { sups: 1, _ignore: false }, _ignore: false };
264
+ */
265
+ type InjectDeep<T, I extends AnyObject> = T extends object ? {
266
+ [K in keyof T]: T[K] extends object ? T[K] & I & DeepInject<T[K], I> : T[K];
267
+ } & I : T;
268
+
269
+ /**
270
+ * Removes undefined from union type.
271
+ * @since 0.0.1
272
+ */
273
+ type Defined<T> = Exclude<T, undefined>;
274
+
275
+ /**
276
+ * Return never if type does not match JSON schema.
277
+ *
278
+ * @since 0.0.1
279
+ * @example
280
+ * type Schema = Jsonish<{ sus: string; am: string; }>; // OK
281
+ * type AlterSchema = Jsonish<{ sus: string; am: () => {}; }>; // Causes error
282
+ */
283
+ type Jsonish<T extends Jsonifiable> = T extends Jsonifiable ? T : never;
284
+
285
+ /**
286
+ * Modifies K (Key) in T (Type), replace it with R (Replacement).
287
+ *
288
+ * @since 0.0.1
289
+ * @example
290
+ * type ExcludedStore = Modify<IStore, 'appSettings', { appName: 'Simple name' }>; // Key in IStore has been replaced with new type.
291
+ */
292
+ type Modify<T, K extends keyof T, R> = Omit<T, K> & {
293
+ [Key in K]: R;
294
+ };
295
+
296
+ /**
297
+ * Make union type of T and null.
298
+ * @since 0.0.1
299
+ */
300
+ type Nullable<T> = T | null;
301
+
302
+ /**
303
+ * Get typeof key of Record.
304
+ *
305
+ * @since 0.0.1
306
+ * @example
307
+ * type Key = RecordKey<Record<string, number>>; // string
308
+ */
309
+ type RecordKey<R extends Record<any, any>> = R extends Record<infer K, any> ? K : never;
310
+
311
+ /**
312
+ * Get typeof value of Record.
313
+ *
314
+ * @since 0.0.1
315
+ * @example
316
+ * type Value = RecordValue<Record<string, number>>; // number
317
+ */
318
+ type RecordValue<R extends Record<any, any>> = R extends Record<any, infer V> ? V : never;
319
+
320
+ /**
321
+ * This type replace return type of function with other type.
322
+ *
323
+ * @since 0.0.1
324
+ * @example
325
+ * type StringFC<T = {}> = ReplaceReturnType<FC<T>, string>;
326
+ */
327
+ type ReplaceReturnType<TFn, TR> = TFn extends (...a: infer A) => any ? (...a: A) => TR : never;
328
+
329
+ /**
330
+ * Works as Partial, but makes only specified keys partial.
331
+ *
332
+ * @since 0.0.1
333
+ * @example
334
+ * type Super = SelectivePartial<{
335
+ * name: string;
336
+ * address: {
337
+ * street: string;
338
+ * number: number
339
+ * }
340
+ * }, 'address'>;
341
+ *
342
+ * // Property 'address' will be partial.
343
+ */
344
+ type SelectivePartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
345
+
346
+ /**
347
+ * Makes type union of type T and undefined
348
+ * @since 0.0.1
349
+ */
350
+ type Undefinable<T> = T | undefined;
351
+
352
+ /**
353
+ * The strict version of Omit. Allows to remove only
354
+ * keys that are presented in T type.
355
+ *
356
+ * @since 0.0.1
357
+ * @example
358
+ * type Tree = {
359
+ * height: number;
360
+ * age: number;
361
+ * name: string;
362
+ * };
363
+ *
364
+ * // TS2344: Type 'weight' does not satisfy the constraint keyof Tree
365
+ * type TreeInfo = StrictOmit<Tree, 'weight'>;
366
+ *
367
+ * // Works just like usual Omit
368
+ * type CorrectTreeInfo = StrictOmit<Tree, 'name'>;
369
+ */
370
+ type StrictOmit<T, K extends keyof T> = Omit<T, K>;
371
+
372
+ /**
373
+ * Extracts first type from two generics. Is helper type for {@link OneOf} type.
374
+ * @since 0.0.1
375
+ */
376
+ type OnlyFirst<F, S> = F & {
377
+ [Key in keyof Omit<S, keyof F>]?: never;
378
+ };
379
+ /**
380
+ * Chooses only one of types array.
381
+ *
382
+ * @since 0.0.1
383
+ * @example
384
+ * type Email = {
385
+ * person: string;
386
+ * content: string;
387
+ * address: string;
388
+ * };
389
+ *
390
+ * type Mail = {
391
+ * person: string;
392
+ * content: string;
393
+ * postCode: number;
394
+ * };
395
+ *
396
+ * type Letter = OneOf<[Email, Mail]>;
397
+ *
398
+ * // Will error, cause address is not assignable to type never.
399
+ * const email: Letter = {
400
+ * person: 'person',
401
+ * content: 'content',
402
+ * address: '',
403
+ * postCode: 12,
404
+ * };
405
+ */
406
+ type OneOf<TypesArray extends any[], Res = never, AllProperties = MergeTypes<TypesArray>> = TypesArray extends [infer Head, ...infer Rem] ? OneOf<Rem, Res | OnlyFirst<Head, AllProperties>, AllProperties> : Res;
407
+
408
+ /**
409
+ * Merge array of types to one type.
410
+ * @since 0.0.1
411
+ */
412
+ type MergeTypes<TypesArray extends any[], Res = EmptyObject> = TypesArray extends [infer Head, ...infer Rem] ? MergeTypes<Rem, Res & Head> : Res;
413
+
414
+ /**
415
+ * Allows to pass undefined as Omit`s generic. Weakly omits type.
416
+ *
417
+ * @since 0.0.1
418
+ * @example
419
+ * // Will not omit any keys
420
+ * type Lib = WeakOmit<{ bookCount: number; date: string }, undefined>;
421
+ *
422
+ * // Will omit
423
+ * type LibStrong = WeakOmit<{ bookCount: number; date: string }, 'date'>;
424
+ */
425
+ type WeakOmit<Obj extends AnyObject, Keys extends keyof Obj | undefined = undefined> = Keys extends keyof Obj ? Omit<Obj, Keys> : Obj;
426
+
427
+ /**
428
+ * Makes types don`t merging in unions.
429
+ *
430
+ * @since 0.0.1
431
+ * @example
432
+ * type Languages = 'TypeScript' | 'JavaScript' | Lenient<string>;
433
+ * // ^? "TypeScript" | "JavaScript" | string
434
+ */
435
+ type Lenient<T> = T & {};
436
+ /**
437
+ * This type allows any string, but also saves compiler`s autocomplete
438
+ * feature.
439
+ *
440
+ * @since 0.0.1
441
+ * @example
442
+ * type Languages = 'TypeScript' | 'JavaScript';
443
+ *
444
+ * function handleLanguage(lang: LenientAutocomplete<Languages>) {
445
+ * // ^? string (but autocomplete feature is still here)
446
+ * console.log(lang);
447
+ * }
448
+ */
449
+ type LenientAutocomplete<T extends string> = T | Lenient<string>;
450
+
451
+ /**
452
+ * Presents plain object in pretty form.
453
+ */
454
+ type Prettify<T> = {
455
+ [K in keyof T]: T[K];
456
+ } & {};
457
+ /**
458
+ * Presents object in pretty form recursively.
459
+ */
460
+ type PrettifyDeep<T> = {
461
+ [K in keyof T]: T[K] extends AnyObject ? Prettify<PrettifyDeep<T[K]>> : T[K];
462
+ };
463
+
464
+ /**
465
+ * Creates pipelines of functions that will be executed only
466
+ * when you will call whole pipeline.
467
+ *
468
+ * @since 0.0.1
469
+ *
470
+ * @param fn
471
+ *
472
+ * @example
473
+ * const stringToDateAndTime = pipe(Date.parse)
474
+ * .pipe(n => new Date(n))
475
+ * .pipe(d => d.toDateString())
476
+ * .pipe(s => s.split('T'))
477
+ * .pipe(([date, time]) => ({ date, time }));
478
+ *
479
+ * const res = stringToDateAndTime('Jan 1, 2024');
480
+ * // ^? { date: string | undefined; time: string | undefined }
481
+ *
482
+ * @see https://youtu.be/bH61wRMqp-o?si=D-2Az-_dUFBxG9HG&t=429
483
+ */
484
+ declare function pipe<A, B>(fn: (a: A) => B): {
485
+ (a: A): B;
486
+ pipe<C>(fn2: (b: B) => C): {
487
+ (a: A): C;
488
+ pipe<C_1>(fn2: (b: C) => C_1): {
489
+ (a: A): C_1;
490
+ pipe<C_2>(fn2: (b: C_1) => C_2): {
491
+ (a: A): C_2;
492
+ pipe<C_3>(fn2: (b: C_2) => C_3): {
493
+ (a: A): C_3;
494
+ pipe<C_4>(fn2: (b: C_3) => C_4): {
495
+ (a: A): C_4;
496
+ pipe<C_5>(fn2: (b: C_4) => C_5): {
497
+ (a: A): C_5;
498
+ pipe<C_6>(fn2: (b: C_5) => C_6): {
499
+ (a: A): C_6;
500
+ pipe<C_7>(fn2: (b: C_6) => C_7): {
501
+ (a: A): C_7;
502
+ pipe<C_8>(fn2: (b: C_7) => C_8): {
503
+ (a: A): C_8;
504
+ pipe<C_9>(fn2: (b: C_8) => C_9): {
505
+ (a: A): C_9;
506
+ pipe<C_10>(fn2: (b: C_9) => C_10): /*elided*/ any;
507
+ };
508
+ };
509
+ };
510
+ };
511
+ };
512
+ };
513
+ };
514
+ };
515
+ };
516
+ };
517
+ };
518
+
519
+ /**
520
+ * Capitalizes string (makes first letter uppercase).
521
+ * @since 0.0.1
522
+ */
523
+ declare function capitalize<T extends string>(str: T): Capitalize<T>;
524
+ /**
525
+ * Un-capitalizes string (makes first letter lowercase).
526
+ * @since 0.0.1
527
+ */
528
+ declare function uncapitalize<T extends string>(str: T): Uncapitalize<T>;
529
+
530
+ type Preid = 'alpha' | 'beta' | 'rc';
531
+ interface VersionData {
532
+ /** Version in format: (__``x.x.x``__-beta.x) */
533
+ version: Nullable<string>;
534
+ /** Version preid. (x.x.x-__``beta``__.x) */
535
+ preid?: LenientAutocomplete<Preid>;
536
+ /** Number of pre-release. (x.x.x-beta.__``12``__) */
537
+ prerelease?: string;
538
+ }
539
+ /**
540
+ * Parses version with preid.
541
+ *
542
+ * @since 0.0.1
543
+ *
544
+ * @param raw
545
+ *
546
+ * @example
547
+ * const { version, preid } = parseVersion('0.0.0-beta.0');
548
+ * // version = '0.0.0'
549
+ * // preid = 'beta'
550
+ */
551
+ declare const parseVersion: (raw: string) => VersionData;
552
+
553
+ /**
554
+ * Transforms any given string to transliterated variant.
555
+ *
556
+ * @since 0.0.1
557
+ */
558
+ declare const transliterate: transliteration.TransliterateFunction;
559
+
560
+ /**
561
+ * Constraints number with min and max values.
562
+ *
563
+ * @example Min value
564
+ * console.log({
565
+ * ogNum: 1, // 1
566
+ * minmax: minmax(1, [2, undefined]), // 2
567
+ * });
568
+ *
569
+ * @example Max value
570
+ * console.log({
571
+ * ogNum: 1001, // 1001
572
+ * minmax: minmax(1001, [undefined, 900]), // 900
573
+ * });
574
+ *
575
+ * @example Min and max value
576
+ * console.log({
577
+ * ogNum: 600, // 600
578
+ * minmax: minmax(1001, [2, 900]), // 600
579
+ * });
580
+ */
581
+ declare const minmax: (num: number, [min, max]: [min: number | undefined, max: number | undefined]) => number;
582
+
583
+ /**
584
+ * Creates properly type object with jsxDotNotation.
585
+ *
586
+ * @param comp
587
+ * @param rest
588
+ *
589
+ * @example
590
+ * const FlexComp: FC<PropsWithChildren> = ({ children }) => <div>{children}</div>;
591
+ * const FlexRow: FC<PropsWithChildren & { short?: boolean }> = ({ children }) => (
592
+ * <div>{children}</div>
593
+ * );
594
+ * const FlexCol: FC<PropsWithChildren> = ({ children }) => <div>{children}</div>;
595
+ *
596
+ * const Flex = jsxDotNotation(FlexComp, {
597
+ * Row: FlexRow,
598
+ * Col: FlexCol,
599
+ * });
600
+ *
601
+ * const Am = () => {
602
+ * return (
603
+ * <Flex>
604
+ * <Flex.Row short>
605
+ * <Flex.Col></Flex.Col>
606
+ * </Flex.Row>
607
+ * </Flex>
608
+ * );
609
+ * };
610
+ */
611
+ declare function jsxDotNotation<Props = EmptyObject, Rest extends Record<string, FC<any>> = EmptyObject>(comp: FC<Props>, rest: Rest): FC<Props> & Rest;
612
+
613
+ export { type AnyFC, type AnyObject, type ArrayItemType, type ArrayType, type AsyncFC, type AsyncReturnType, type AsyncVariableFC, type DataAttributes, type Defined, type EmptyObject, type FCProps, type FcProps, type Fn, type FunctionalChildren, type InjectDeep, type Jsonish, type Lenient, type LenientAutocomplete, type MatchType, type MergeTypes, type Modify, type NextErrorParams, type NextParams, type NextSearchParams, type Nullable, type OneOf, type OnlyFirst, type Preid, type Prettify, type PrettifyDeep, type RecordKey, type RecordValue, type ReplaceReturnType, type SelectivePartial, type SetState, type StrictOmit, type Synchronous, type Undefinable, type VariableFC, type VariableProps, type VersionData, type WeakOmit, type Writeable, type WriteableDeep, capitalize, jsxDotNotation, minmax, parseVersion, pipe, transliterate, uncapitalize };