@zimic/ws 0.1.0-canary.5 → 0.1.0-canary.7
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/index.d.ts +24 -2
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -68,15 +68,37 @@ declare namespace JSONValue {
|
|
|
68
68
|
/** A loose version of the JSON value type. JSON objects are not strictly typed. */
|
|
69
69
|
type Loose<Type extends JSON.Loose = JSON.Loose> = Type;
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Recursively converts a type to its JSON-serialized version. Dates are converted to strings and keys with non-JSON
|
|
73
|
+
* values are excluded.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* import { type JSONSerialized } from '@zimic/http';
|
|
77
|
+
*
|
|
78
|
+
* type SerializedUser = JSONSerialized<{
|
|
79
|
+
* id: string;
|
|
80
|
+
* email: string;
|
|
81
|
+
* createdAt: Date;
|
|
82
|
+
* save: () => Promise<void>;
|
|
83
|
+
* }>;
|
|
84
|
+
* // {
|
|
85
|
+
* // id: string;
|
|
86
|
+
* // email: string;
|
|
87
|
+
* // createdAt: string;
|
|
88
|
+
* // }
|
|
89
|
+
*/
|
|
90
|
+
type JSONSerialized<Type> = Type extends JSONValue ? Type : Type extends Date ? string : Type extends (...parameters: never[]) => unknown ? never : Type extends symbol ? never : Type extends Map<infer _Key, infer _Value> ? Record<string, never> : Type extends Set<infer _Value> ? Record<string, never> : Type extends (infer ArrayItem)[] ? JSONSerialized<ArrayItem>[] : Type extends object ? {
|
|
91
|
+
[Key in keyof Type as [JSONSerialized<Type[Key]>] extends [never] ? never : Key]: JSONSerialized<Type[Key]>;
|
|
92
|
+
} : never;
|
|
71
93
|
declare global {
|
|
72
94
|
interface JSON {
|
|
73
95
|
readonly value: unique symbol;
|
|
74
96
|
stringify<Value>(value: Value, replacer?: ((this: any, key: string, value: Value) => any) | (number | string)[] | null, space?: string | number): JSONStringified$1<Value>;
|
|
75
|
-
parse<Value>(text: JSONStringified$1<Value>, reviver?: (this: any, key: string, value: any) => any): Value
|
|
97
|
+
parse<Value>(text: JSONStringified$1<Value>, reviver?: (this: any, key: string, value: any) => any): JSONSerialized<Value>;
|
|
76
98
|
}
|
|
77
99
|
}
|
|
78
100
|
type JSONStringified$1<Value> = string & {
|
|
79
|
-
[JSON.value]: Value
|
|
101
|
+
[JSON.value]: JSONSerialized<Value>;
|
|
80
102
|
};
|
|
81
103
|
|
|
82
104
|
/**
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"api",
|
|
15
15
|
"static"
|
|
16
16
|
],
|
|
17
|
-
"version": "0.1.0-canary.
|
|
17
|
+
"version": "0.1.0-canary.7",
|
|
18
18
|
"homepage": "https://zimic.dev/docs/ws",
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -87,11 +87,11 @@
|
|
|
87
87
|
"ws": "8.18.3"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@types/node": "^25.0.
|
|
90
|
+
"@types/node": "^25.0.3",
|
|
91
91
|
"@types/ws": "^8.18.1",
|
|
92
|
-
"@vitest/browser": "^4.0.
|
|
93
|
-
"@vitest/browser-playwright": "^4.0.
|
|
94
|
-
"@vitest/coverage-istanbul": "^4.0.
|
|
92
|
+
"@vitest/browser": "^4.0.16",
|
|
93
|
+
"@vitest/browser-playwright": "^4.0.16",
|
|
94
|
+
"@vitest/coverage-istanbul": "^4.0.16",
|
|
95
95
|
"@zimic/eslint-config-node": "workspace:*",
|
|
96
96
|
"@zimic/interceptor": "workspace:*",
|
|
97
97
|
"@zimic/lint-staged-config": "workspace:*",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"playwright": "^1.56.1",
|
|
103
103
|
"tsup": "^8.4.0",
|
|
104
104
|
"typescript": "^5.9.3",
|
|
105
|
-
"vitest": "^4.0.
|
|
105
|
+
"vitest": "^4.0.16"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
108
|
"typescript": ">=5.0.0"
|