Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The inferred type of <SchemaName> references an inaccessible this type. A type annotation is necessary. #3813

Open
ifjkt opened this issue Oct 21, 2024 · 1 comment

Comments

@ifjkt
Copy link

ifjkt commented Oct 21, 2024

I'm using Zod with NestJS and facing an issue when trying to declare properties as .nullish() or .nullable().

An example

import { z } from 'zod';

export const partnerSchema = z.object({
  projectName: z.string(),
  startDate: z.coerce.date(),
  projectDuration: z.number().nullish(),
});

This yields a TS2527 error.

image

@sunnylost
Copy link

I used this code snippet, but it didn’t raise any exceptions. This might be related to the TypeScript configuration or other factors. Could you provide a minimal reproduction?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants