@alessiofrittoli/type-utils 0.2.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Type Utils ❇️
2
2
 
3
- Version 0.2.0
3
+ Version 0.3.0
4
4
 
5
5
  ## Lightweight TypeScript types utilities
6
6
 
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?: (key: string, value: any) => any, space?: string | number): string & Stringified<T>;
7
- parse<T>(text: string | Stringified<T>, reviver?: (key: any, value: any) => any): T;
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?: (key: string, value: any) => any, space?: string | number): string & Stringified<T>;
7
- parse<T>(text: string | Stringified<T>, reviver?: (key: any, value: any) => any): T;
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,43 +1,42 @@
1
1
  {
2
- "name": "@alessiofrittoli/type-utils",
3
- "version": "0.2.0",
4
- "description": "Lightweight TypeScript types utilities",
5
- "author": {
6
- "name": "Alessio Frittoli",
7
- "email": "info@alessiofrittoli.it",
8
- "url": "https://alessiofrittoli.it"
9
- },
10
- "license": "MIT",
11
- "keywords": [
12
- "typescript"
13
- ],
14
- "homepage": "https://github.com/alessiofrittoli/type-utils#readme",
15
- "bugs": {
16
- "url": "https://github.com/alessiofrittoli/type-utils/issues",
17
- "email": "info@alessiofrittoli.it"
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/alessiofrittoli/type-utils.git"
22
- },
23
- "main": "./dist/index.js",
24
- "types": "./dist/index.d.ts",
25
- "files": [
26
- "dist",
27
- "scripts"
28
- ],
29
- "devDependencies": {
30
- "@eslint/js": "^9.15.0",
31
- "@types/node": "^22.10.0",
32
- "eslint": "^9.15.0",
33
- "globals": "^15.12.0",
34
- "tsup": "^8.3.5",
35
- "typescript": "^5.7.2",
36
- "typescript-eslint": "^8.16.0"
37
- },
38
- "scripts": {
39
- "build": "eslint && tsup",
40
- "lint": "eslint",
41
- "postinstall": "node scripts/postinstall/index.js"
42
- }
2
+ "name": "@alessiofrittoli/type-utils",
3
+ "version": "0.3.0",
4
+ "description": "Lightweight TypeScript types utilities",
5
+ "author": {
6
+ "name": "Alessio Frittoli",
7
+ "email": "info@alessiofrittoli.it",
8
+ "url": "https://alessiofrittoli.it"
9
+ },
10
+ "license": "MIT",
11
+ "keywords": [
12
+ "typescript"
13
+ ],
14
+ "homepage": "https://github.com/alessiofrittoli/type-utils#readme",
15
+ "bugs": {
16
+ "url": "https://github.com/alessiofrittoli/type-utils/issues",
17
+ "email": "info@alessiofrittoli.it"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/alessiofrittoli/type-utils.git"
22
+ },
23
+ "main": "./dist/index.js",
24
+ "types": "./dist/index.d.ts",
25
+ "files": [
26
+ "dist", "scripts"
27
+ ],
28
+ "scripts": {
29
+ "build": "eslint && tsup",
30
+ "lint": "eslint",
31
+ "postinstall": "node scripts/postinstall/index.js"
32
+ },
33
+ "devDependencies": {
34
+ "@eslint/js": "^9.15.0",
35
+ "@types/node": "^22.10.0",
36
+ "eslint": "^9.15.0",
37
+ "globals": "^15.12.0",
38
+ "tsup": "^8.3.5",
39
+ "typescript": "^5.7.2",
40
+ "typescript-eslint": "^8.16.0"
41
+ }
43
42
  }