Skip to content

Commit

Permalink
Adds getters to Map for key + value (#2356)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbar authored May 22, 2023
1 parent a3c5256 commit 4f75cbc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Binary file added bun.lockb
Binary file not shown.
6 changes: 6 additions & 0 deletions deno/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3441,6 +3441,12 @@ export class ZodMap<
ZodMapDef<Key, Value>,
Map<Key["_input"], Value["_input"]>
> {
get keySchema() {
return this._def.keyType;
}
get valueSchema() {
return this._def.valueType;
}
_parse(input: ParseInput): ParseReturnType<this["_output"]> {
const { status, ctx } = this._processInputParams(input);
if (ctx.parsedType !== ZodParsedType.map) {
Expand Down
6 changes: 6 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3441,6 +3441,12 @@ export class ZodMap<
ZodMapDef<Key, Value>,
Map<Key["_input"], Value["_input"]>
> {
get keySchema() {
return this._def.keyType;
}
get valueSchema() {
return this._def.valueType;
}
_parse(input: ParseInput): ParseReturnType<this["_output"]> {
const { status, ctx } = this._processInputParams(input);
if (ctx.parsedType !== ZodParsedType.map) {
Expand Down

0 comments on commit 4f75cbc

Please sign in to comment.