zod-v3-to-v4 1.7.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -130,7 +130,7 @@ export function convertDeprecatedErrorKeysToErrorFunction(node) {
130
130
  export function convertZodErrorToTreeifyError(sourceFile, zodName) {
131
131
  sourceFile
132
132
  .getDescendantsOfKind(SyntaxKind.CallExpression)
133
- .filter((expression) => isZodReference(zodName, ["ZodJSONSchema", "ZodError"], expression))
133
+ .filter((expression) => isZodReference(zodName, ["ZodType", "ZodError"], expression))
134
134
  .filter((expression) => {
135
135
  const argsCount = expression.getArguments().length;
136
136
  const methodCalled = expression.getExpression().getLastChild();
@@ -150,7 +150,7 @@ export function convertZodErrorToTreeifyError(sourceFile, zodName) {
150
150
  });
151
151
  sourceFile
152
152
  .getDescendantsOfKind(SyntaxKind.PropertyAccessExpression)
153
- .filter((expression) => isZodReference(zodName, ["ZodJSONSchema", "ZodError"], expression))
153
+ .filter((expression) => isZodReference(zodName, ["ZodType", "ZodError"], expression))
154
154
  .filter((expression) => {
155
155
  const looksLikeZodErrorFormErrors = expression.getName() === "formErrors";
156
156
  const looksLikeZodErrorFieldErrors = expression.getName() === "fieldErrors";
@@ -164,7 +164,7 @@ export function convertZodErrorToTreeifyError(sourceFile, zodName) {
164
164
  export function convertZodErrorAddIssueToDirectPushes(sourceFile, zodName) {
165
165
  sourceFile
166
166
  .getDescendantsOfKind(SyntaxKind.CallExpression)
167
- .filter((expression) => isZodReference(zodName, ["ZodJSONSchema", "ZodError"], expression))
167
+ .filter((expression) => isZodReference(zodName, ["ZodType", "ZodError"], expression))
168
168
  .filter((expression) => {
169
169
  const argsCount = expression.getArguments().length;
170
170
  const methodCalled = expression.getExpression().getLastChild();
package/dist/migrate.js CHANGED
@@ -23,7 +23,7 @@ export function migrateZodV3ToV4(sourceFile, options = {}) {
23
23
  }
24
24
  const parentType = node.getFirstAncestorByKind(SyntaxKind.QualifiedName);
25
25
  if (parentType?.getText().endsWith("ZodSchema")) {
26
- parentType?.getRight().replaceWithText("ZodJSONSchema");
26
+ parentType?.getRight().replaceWithText("ZodType");
27
27
  }
28
28
  const parentStatement = node.getParentWhile(isZodNode) || node;
29
29
  if (!isZodNode(parentStatement)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-v3-to-v4",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Migrate Zod from v3 to v4",
5
5
  "keywords": [
6
6
  "zod",