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 referenced namespace is not renamed #102

Open
Amorites opened this issue Nov 29, 2022 · 0 comments
Open

The referenced namespace is not renamed #102

Amorites opened this issue Nov 29, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Amorites
Copy link

Bug description

The referenced namespace in input interface is not renamed, which would cause a "Cannot find name" error in output file.

Input

export namespace parent_schema_definitions {
    export interface DynamicRecordBaseView {
        userId: number;
    }
}

export interface Foo {
    bar: parent_schema_definitions.DynamicRecordBaseView;
}

Expected output

// Generated by ts-to-zod
import { z } from 'zod';

export const parentSchemaDefinitionsDynamicRecordBaseViewSchema = z.object({
  userId: z.number(),
});

export const fooSchema = z.object({
  bar: parentSchemaDefinitionsDynamicRecordBaseViewSchema,
});

OR

// Generated by ts-to-zod
import { z } from 'zod';

export namespace parent_schema_definitions {
    export const DynamicRecordBaseViewSchema = z.object({
      userId: z.number(),
    });
}

export const fooSchema = z.object({
    bar: parent_schema_definitions.DynamicRecordBaseView,
});

Actual output

// Generated by ts-to-zod
import { z } from 'zod';

export const parentSchemaDefinitionsDynamicRecordBaseViewSchema = z.object({
  userId: z.number(),
});

export const fooSchema = z.object({
  bar: z.literal(parent_schema_definitions.DynamicRecordBaseView),
});

Versions

  • Typescript: v4.9.3
  • Zod: v3.19.1
  • ts-to-zod: v1.13.1
@Amorites Amorites changed the title The referenced namespace in input interface is not renamed The referenced namespace is not renamed Nov 29, 2022
@tvillaren tvillaren added the bug Something isn't working label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants