fabien0102 / ts-to-zod

Generate zod schemas from typescript types/interfaces
MIT License
1.22k stars 67 forks source link

fix: add type notation to type imports #264

Closed sleewoo closed 2 months ago

sleewoo commented 2 months ago

Why

fix for https://github.com/fabien0102/ts-to-zod/issues/263

I dared to rename requiresImport in generateZodSchema.ts but it was not used for anything else, just to signal about enum import.

Also added sourceEnumImports in generate.ts to collect enum imports and distinguish between another imports.

Finally modified sourceTypeImportsValues array by appending type notation to non-enum imports.

Hoping this is in accordance with project style.

Thanks.