@purr-core/utils.definitions 0.0.1
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.
- package/dist/_interfaces.d.ts +11 -0
- package/dist/_types.d.ts +58 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TAny } from './_types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents an extendable object where keys are strings and values can be of any type.
|
|
5
|
+
*
|
|
6
|
+
* @interface IExtendable
|
|
7
|
+
* @template TAny - The type of the values in the extendable object.
|
|
8
|
+
*/
|
|
9
|
+
export interface IExtendable {
|
|
10
|
+
[key: string]: TAny;
|
|
11
|
+
}
|
package/dist/_types.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A type alias for `any`. This type can represent any value.
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Use this type with caution as it disables type checking for the value it is assigned to.
|
|
8
|
+
*/
|
|
9
|
+
export type TAny = any;
|
|
10
|
+
/**
|
|
11
|
+
* Type definition for a React component function.
|
|
12
|
+
*
|
|
13
|
+
* @typedef {TComponent}
|
|
14
|
+
*
|
|
15
|
+
* @param {...TAny} args - The arguments passed to the component.
|
|
16
|
+
*
|
|
17
|
+
* @returns {ReactNode} - The rendered React node.
|
|
18
|
+
*/
|
|
19
|
+
export type TComponent = (...args: TAny) => ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* A type representing a higher-order component (HOC) function.
|
|
22
|
+
*
|
|
23
|
+
* This function takes a React element or node as an argument and returns a React node.
|
|
24
|
+
*
|
|
25
|
+
* @param component - The React element or node to be wrapped by the HOC.
|
|
26
|
+
* @returns A new React node after applying the HOC.
|
|
27
|
+
*/
|
|
28
|
+
export type THighOrderComponent = (component: ReactElement | ReactNode) => ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* A type representing a function that iterates over an array.
|
|
31
|
+
*
|
|
32
|
+
* @template T - The type of elements in the array.
|
|
33
|
+
* @param value - The current element being processed in the array.
|
|
34
|
+
* @param index - The index of the current element being processed in the array.
|
|
35
|
+
* @param array - The array that `TIterator` is iterating over.
|
|
36
|
+
* @returns An unknown value.
|
|
37
|
+
*/
|
|
38
|
+
export type TIterator = <T>(value: T, index?: number, array?: T[]) => unknown;
|
|
39
|
+
/**
|
|
40
|
+
* A generic function type that takes an optional parameter of type `T` and returns a value of type `RT`.
|
|
41
|
+
*
|
|
42
|
+
* @template RT - The return type of the function.
|
|
43
|
+
* @template T - The type of the optional parameter.
|
|
44
|
+
* @param item - An optional parameter of type `T`.
|
|
45
|
+
* @returns A value of type `RT`.
|
|
46
|
+
*/
|
|
47
|
+
export type TFunction<RT> = <T>(item?: T) => RT;
|
|
48
|
+
/**
|
|
49
|
+
* Represents the boundary of an asynchronous operation, encapsulating both the result and any potential error.
|
|
50
|
+
*
|
|
51
|
+
* @template T - The type of the result.
|
|
52
|
+
* @property {unknown | null} error - The error encountered during the asynchronous operation, if any.
|
|
53
|
+
* @property {T | null} result - The result of the asynchronous operation, if successful.
|
|
54
|
+
*/
|
|
55
|
+
export type TAsyncBoundary<T> = {
|
|
56
|
+
error: unknown | null;
|
|
57
|
+
result: T | null;
|
|
58
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@purr-core/utils.definitions",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"typescript": "*",
|
|
25
|
+
"react": "*"
|
|
26
|
+
},
|
|
27
|
+
"author": "@DinhThienPhuc",
|
|
28
|
+
"license": "ISC",
|
|
29
|
+
"description": "",
|
|
30
|
+
"sideEffects": false,
|
|
31
|
+
"scripts": {
|
|
32
|
+
"dev": "vite build --watch",
|
|
33
|
+
"build": "tsc && vite build",
|
|
34
|
+
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
35
|
+
}
|
|
36
|
+
}
|