Skip to content

Commit e863827

Browse files
fix(lib): Avoid unnecessary imports of Zod #139
1 parent 7e590c5 commit e863827

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
## [0.17.2] - 2025-04-14
11+
12+
### Fixed
13+
14+
- Avoid unnecessary import of Zod library (#139)
15+
1016
## [0.17.1] - 2025-04-12
1117

1218
### Fixed
@@ -377,7 +383,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
377383

378384
- Initial release
379385

380-
[unreleased]: https://github.com/PerfectlyNormal/TypeContractor/compare/v0.17.1...HEAD
386+
[unreleased]: https://github.com/PerfectlyNormal/TypeContractor/compare/v0.17.2...HEAD
387+
[0.17.2]: https://github.com/PerfectlyNormal/TypeContractor/compare/v0.17.1...v0.17.2
381388
[0.17.1]: https://github.com/PerfectlyNormal/TypeContractor/compare/v0.17.0...v0.17.1
382389
[0.17.0]: https://github.com/PerfectlyNormal/TypeContractor/compare/v0.16.0...v0.17.0
383390
[0.16.0]: https://github.com/PerfectlyNormal/TypeContractor/compare/v0.15.0...v0.16.0

TypeContractor.Tests/TypeScript/ApiClientWriterTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ public void Avoids_Duplicate_Imports_With_Same_ReturnType_And_Parameter()
357357
var file = File.ReadAllText(result).Trim();
358358
file.Should()
359359
.NotBeEmpty()
360-
.And.Contain("import { z } from 'zod';")
361360
.And.Contain("import { PersonDto, PersonDtoSchema } from '~/TypeContractor/Tests/TypeScript/PersonDto';")
362361
.And.NotContain("import { PersonDto } from '~/TypeContractor/Tests/TypeScript/PersonDto';")
363362
.And.Contain("export class TestClient {")

TypeContractor/TypeScript/ApiClientWriter.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,7 @@ private List<string> BuildImports(IEnumerable<ApiClientEndpoint> endpoints, IEnu
189189
var zodImport = ZodSchemaWriter.BuildImport(returnType);
190190

191191
if (!string.IsNullOrWhiteSpace(zodImport))
192-
{
193-
needZodLibrary = true;
194192
importTypes.Add(zodImport);
195-
}
196193
}
197194

198195
var outputType = allTypes.First(x => x.FullName == (returnType.InnerType?.FullName ?? returnType.FullName));

0 commit comments

Comments
 (0)