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
Empty interfaces' extends
statements are ignored
#108
Comments
NexZhu
added a commit
to daotl/ts-to-zod
that referenced
this issue
Jan 11, 2023
With #109 applied, there are still some issues with validation. Input: export namespace std {
export interface BaseObject {
"id": string;
}
export interface $Object extends BaseObject {}
}
export interface Base extends std.$Object {
"createdAt": Date;
} The output is actually correct with // Generated by ts-to-zod
import { z } from 'zod'
export const stdBaseObjectSchema = z.object({
id: z.string(),
})
export const stdObjectSchema = stdBaseObjectSchema.extend({})
export const baseSchema = stdObjectSchema.extend({
createdAt: z.date(),
}) But
|
NexZhu
added a commit
to daotl/ts-to-zod
that referenced
this issue
Jan 11, 2023
fabien0102
pushed a commit
that referenced
this issue
Jan 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug description
For example, in the following code
Object
is an empty interface extendingBaseObject
, which has anid
field.Running
ts-to-zod
fails with:And running with
--skipValidation
generates:Expected output:
The problematic code is in
generateZodSchema.ts
,schemaExtensionClauses
is handled only whenproperties.length > 0
:Versions
v4.8.4
The text was updated successfully, but these errors were encountered: