Skip to content

Commit 7a87970

Browse files
committed
fix(fs): file serialization typing
1 parent 974daed commit 7a87970

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/fs/src/file.lib.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,7 @@ class FsFileWrite<
10221022
* @throws If schema validation fails or if the write operation fails
10231023
*/
10241024
public async json<T>(
1025-
data: TSchema extends ZodSchema<infer O> ? O : T,
1025+
data: TSchema extends ZodSchema<any, infer I> ? I : T,
10261026
): Promise<void> {
10271027
return this.text(json.serialize(data, { schema: this._schema }));
10281028
}
@@ -1040,7 +1040,7 @@ class FsFileWrite<
10401040
* @throws If schema validation fails or if the write operation fails
10411041
*/
10421042
public async prettyJson<T>(
1043-
data: TSchema extends ZodSchema<infer O> ? O : T,
1043+
data: TSchema extends ZodSchema<any, infer I> ? I : T,
10441044
): Promise<void> {
10451045
return this.text(
10461046
json.serialize(data, { schema: this._schema, pretty: true }) + "\n",
@@ -1057,7 +1057,9 @@ class FsFileWrite<
10571057
* @synchronous
10581058
* @throws If schema validation fails or if the write operation fails
10591059
*/
1060-
public jsonSync<T>(data: TSchema extends ZodSchema<infer O> ? O : T): void {
1060+
public jsonSync<T>(
1061+
data: TSchema extends ZodSchema<any, infer I> ? I : T,
1062+
): void {
10611063
return this.textSync(json.serialize(data, { schema: this._schema }));
10621064
}
10631065

@@ -1072,7 +1074,7 @@ class FsFileWrite<
10721074
* @throws If schema validation fails or if the write operation fails
10731075
*/
10741076
public prettyJsonSync<T = unknown>(
1075-
data: TSchema extends ZodSchema<infer O> ? O : T,
1077+
data: TSchema extends ZodSchema<any, infer I> ? I : T,
10761078
): void {
10771079
return this.textSync(
10781080
json.serialize(data, { schema: this._schema, pretty: true }) + "\n",
@@ -1089,7 +1091,7 @@ class FsFileWrite<
10891091
* @throws If schema validation fails or if the write operation fails
10901092
*/
10911093
public async yaml<T = unknown>(
1092-
data: TSchema extends ZodSchema<infer O> ? O : T,
1094+
data: TSchema extends ZodSchema<any, infer I> ? I : T,
10931095
): Promise<void> {
10941096
return this.text(yaml.serialize(data, { schema: this._schema }));
10951097
}
@@ -1105,7 +1107,7 @@ class FsFileWrite<
11051107
* @throws If schema validation fails or if the write operation fails
11061108
*/
11071109
public yamlSync<T = unknown>(
1108-
data: TSchema extends ZodSchema<infer O> ? O : T,
1110+
data: TSchema extends ZodSchema<any, infer I> ? I : T,
11091111
): void {
11101112
return this.textSync(yaml.serialize(data, { schema: this._schema }));
11111113
}

0 commit comments

Comments
 (0)