fabien0102 / ts-to-zod

Generate zod schemas from typescript types/interfaces

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

type alias within namespace not resolved

shunjilin opened this issue · comments

Bug description

type alias within a Namespace is not resolved correctly, and leads to the warning Warning: Some schemas can't be generated due to direct or indirect missing dependencies

Input

declare namespace Namespace {
  export type ThisIsAnAlias = MyType;

  export interface MyType {
    someField: string;
  }
}

Expected output

export namespaceThisIsAnAlias = z.object({
  someField: z.string(),
})

export const namespaceMyTypeSchema = z.object({
  someField: z.string(),
});

Actual output

export const namespaceMyTypeSchema = z.object({
  someField: z.string(),
});

Versions

  • typescript@4.5.2
  • zod@3.11.6