Skip to content

Commit 4f75cbc

Browse files
authored
Adds getters to Map for key + value (colinhacks#2356)
1 parent a3c5256 commit 4f75cbc

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

bun.lockb

209 KB
Binary file not shown.

deno/lib/types.ts

+6
Original file line numberDiff line numberDiff line change
@@ -3441,6 +3441,12 @@ export class ZodMap<
34413441
ZodMapDef<Key, Value>,
34423442
Map<Key["_input"], Value["_input"]>
34433443
> {
3444+
get keySchema() {
3445+
return this._def.keyType;
3446+
}
3447+
get valueSchema() {
3448+
return this._def.valueType;
3449+
}
34443450
_parse(input: ParseInput): ParseReturnType<this["_output"]> {
34453451
const { status, ctx } = this._processInputParams(input);
34463452
if (ctx.parsedType !== ZodParsedType.map) {

src/types.ts

+6
Original file line numberDiff line numberDiff line change
@@ -3441,6 +3441,12 @@ export class ZodMap<
34413441
ZodMapDef<Key, Value>,
34423442
Map<Key["_input"], Value["_input"]>
34433443
> {
3444+
get keySchema() {
3445+
return this._def.keyType;
3446+
}
3447+
get valueSchema() {
3448+
return this._def.valueType;
3449+
}
34443450
_parse(input: ParseInput): ParseReturnType<this["_output"]> {
34453451
const { status, ctx } = this._processInputParams(input);
34463452
if (ctx.parsedType !== ZodParsedType.map) {

0 commit comments

Comments
 (0)