Skip to content

Commit

Permalink
Merge pull request #86 from iway1/undeprecate-enums
Browse files Browse the repository at this point in the history
Removes enum deprecation warning
  • Loading branch information
iway1 authored Mar 12, 2023
2 parents 90cc24d + 8f85168 commit 0e5e6d0
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/logging.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ZodFirstPartyTypeKind } from "zod";
import { RTFSupportedZodTypes } from "./supportedZodTypes";

const shownWarnings = {
Expand All @@ -19,16 +18,8 @@ export function duplicateTypeError() {
);
}

export function printWarningsForSchema(type: RTFSupportedZodTypes) {
if (
!shownWarnings.enum &&
type._def.typeName === ZodFirstPartyTypeKind.ZodEnum
) {
err(
"support for z.enum() is deprecated and will be removed in future versions. Prefer z.string() / z.number() etc for dropdowns, selects, and radio buttons. \nSee https://github.com/iway1/react-ts-form/blob/main/field-examples.md for examples"
);
shownWarnings.enum = true;
}
export function printWarningsForSchema(_type: RTFSupportedZodTypes) {
// placeholder in case we need future schema warnings
}

export function printUseEnumWarning() {
Expand Down

1 comment on commit 0e5e6d0

@vercel
Copy link

@vercel vercel bot commented on 0e5e6d0 Mar 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.