Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deno/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,9 +775,9 @@ export class ZodString extends ZodType<string, ZodStringDef, string> {
if (this._def.coerce) {
input.data = String(input.data);
}
const parsedType = this._getType(input);

if (parsedType !== ZodParsedType.string) {
// Inline typecheck for performance
if (typeof input.data !== "string") {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,9 +775,9 @@ export class ZodString extends ZodType<string, ZodStringDef, string> {
if (this._def.coerce) {
input.data = String(input.data);
}
const parsedType = this._getType(input);

if (parsedType !== ZodParsedType.string) {
// Inline typecheck for performance
if (typeof input.data !== "string") {
const ctx = this._getOrReturnCtx(input);
addIssueToContext(ctx, {
code: ZodIssueCode.invalid_type,
Expand Down