@alessiofrittoli/type-utils 0.1.2 → 0.3.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.
- package/README.md +10 -1
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/package.json +4 -4
- package/scripts/postinstall/ts-setup.js +6 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Type Utils ❇️
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.3.0
|
|
4
4
|
|
|
5
5
|
## Lightweight TypeScript types utilities
|
|
6
6
|
|
|
@@ -71,6 +71,15 @@ warnings / errors check.
|
|
|
71
71
|
pnpm lint
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### Contributing
|
|
77
|
+
|
|
78
|
+
Contributions are truly welcome!\
|
|
79
|
+
Please refer to the [Contributing Doc](./CONTRIBUTING.md) for more information on how to start contributing to this project.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
74
83
|
### Security
|
|
75
84
|
|
|
76
85
|
If you believe you have found a security vulnerability, we encourage you to **_responsibly disclose this and NOT open a public issue_**. We will investigate all legitimate reports. Email `security@alessiofrittoli.it` to disclose any security vulnerabilities.
|
package/dist/index.d.mts
CHANGED
|
@@ -3,8 +3,11 @@ declare class Stringified<T> extends String {
|
|
|
3
3
|
}
|
|
4
4
|
declare global {
|
|
5
5
|
interface JSON {
|
|
6
|
-
stringify<T>(value: T, replacer?: (
|
|
7
|
-
|
|
6
|
+
stringify<T>(value: T, replacer?: (this: {
|
|
7
|
+
'': T;
|
|
8
|
+
} | T, key: string, value: T) => any, space?: string | number): T extends Date ? string : string & Stringified<T>;
|
|
9
|
+
stringify<T>(value: T, replacer?: (T extends object ? (keyof T)[] : (number | string)[]) | null, space?: string | number): T extends Date ? string : string & Stringified<T>;
|
|
10
|
+
parse<T, U extends keyof T = keyof T>(text: string | Stringified<T>, reviver?: (key: U, value: T[U]) => any): T extends Date ? string : string & Stringified<T>;
|
|
8
11
|
parse(text: string, reviver?: (key: any, value: any) => any): any;
|
|
9
12
|
}
|
|
10
13
|
interface Body {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,11 @@ declare class Stringified<T> extends String {
|
|
|
3
3
|
}
|
|
4
4
|
declare global {
|
|
5
5
|
interface JSON {
|
|
6
|
-
stringify<T>(value: T, replacer?: (
|
|
7
|
-
|
|
6
|
+
stringify<T>(value: T, replacer?: (this: {
|
|
7
|
+
'': T;
|
|
8
|
+
} | T, key: string, value: T) => any, space?: string | number): T extends Date ? string : string & Stringified<T>;
|
|
9
|
+
stringify<T>(value: T, replacer?: (T extends object ? (keyof T)[] : (number | string)[]) | null, space?: string | number): T extends Date ? string : string & Stringified<T>;
|
|
10
|
+
parse<T, U extends keyof T = keyof T>(text: string | Stringified<T>, reviver?: (key: U, value: T[U]) => any): T extends Date ? string : string & Stringified<T>;
|
|
8
11
|
parse(text: string, reviver?: (key: any, value: any) => any): any;
|
|
9
12
|
}
|
|
10
13
|
interface Body {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alessiofrittoli/type-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Lightweight TypeScript types utilities",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Alessio Frittoli",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@eslint/js": "^9.15.0",
|
|
35
|
-
"@types/node": "^22.
|
|
35
|
+
"@types/node": "^22.10.0",
|
|
36
36
|
"eslint": "^9.15.0",
|
|
37
37
|
"globals": "^15.12.0",
|
|
38
38
|
"tsup": "^8.3.5",
|
|
39
|
-
"typescript": "^5.
|
|
40
|
-
"typescript-eslint": "^8.
|
|
39
|
+
"typescript": "^5.7.2",
|
|
40
|
+
"typescript-eslint": "^8.16.0"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -5,9 +5,13 @@ const project = require( '../../package.json' )
|
|
|
5
5
|
|
|
6
6
|
const tsSetup = () => {
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const projectName = project.name.replace( '@alessiofrittoli/', '' )
|
|
9
|
+
const projectRoot = process.env.INIT_CWD || process.cwd()
|
|
9
10
|
|
|
10
|
-
if (
|
|
11
|
+
if ( projectRoot.endsWith( projectName ) ) {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
if ( ! projectRoot ) {
|
|
11
15
|
console.error( 'INIT_CWD is not set. This script must be run during pnpm install.' )
|
|
12
16
|
process.exit( 1 )
|
|
13
17
|
}
|