-
I'm testing out the beta version but it looks like the type definition has some problems. Following this example I found in the docs: import { createSafeActionClient } from "next-safe-action";
import { z } from "zod";
const actionClient = createSafeActionClient();
const schema = z.object({
username: z.string().min(3).max(10),
password: z.string().min(8).max(100),
});
const loginUser = actionClient
.schema(schema)
.action(async ({ parsedInput: { username, password } }) => {
if (username === "johndoe" && password === "123456") {
return {
success: "Successfully logged in",
};
}
return { failure: "Incorrect credentials" };
}); The first error is with the schema which is not assignable to So my question is if this version is still a work in progress or are those bugs? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yes, v7 is API stable, just waiting for Next.js 14.3.0 (or 15?) release to publish it to the stable channel. Regarding this issue, have you installed the right TypeSchema adapter for Zod? npm i @typeschema/zod |
Beta Was this translation helpful? Give feedback.
Yes, v7 is API stable, just waiting for Next.js 14.3.0 (or 15?) release to publish it to the stable channel.
Regarding this issue, have you installed the right TypeSchema adapter for Zod?