Skip to content

Commit e409495

Browse files
Copilothotlong
andcommitted
Fix code review issues: use proper Zod type inference instead of private internals
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 9e8678f commit e409495

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/spec/src/system/api.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ describe('ApiEndpointSchema', () => {
186186
});
187187

188188
it('should accept different HTTP methods', () => {
189-
const methods: Array<typeof HttpMethod._type> = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'];
189+
const methods: Array<z.infer<typeof HttpMethod>> = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'];
190190

191191
methods.forEach(method => {
192192
const endpoint = ApiEndpointSchema.parse({
@@ -201,7 +201,7 @@ describe('ApiEndpointSchema', () => {
201201
});
202202

203203
it('should accept different implementation types', () => {
204-
const types: Array<typeof endpoint.type> = ['flow', 'script', 'object_operation', 'proxy'];
204+
const types: Array<'flow' | 'script' | 'object_operation' | 'proxy'> = ['flow', 'script', 'object_operation', 'proxy'];
205205

206206
types.forEach(type => {
207207
const endpoint = ApiEndpointSchema.parse({
@@ -257,7 +257,7 @@ describe('ApiEndpointSchema', () => {
257257
});
258258

259259
it('should accept different object operations', () => {
260-
const operations: Array<NonNullable<NonNullable<typeof endpoint.objectParams>['operation']>> = ['find', 'get', 'create', 'update', 'delete'];
260+
const operations: Array<'find' | 'get' | 'create' | 'update' | 'delete'> = ['find', 'get', 'create', 'update', 'delete'];
261261

262262
operations.forEach(operation => {
263263
const endpoint = ApiEndpointSchema.parse({

packages/spec/src/ui/report.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ describe('ReportSchema', () => {
254254
});
255255

256256
it('should accept different report types', () => {
257-
const types: Array<typeof ReportType._type> = ['tabular', 'summary', 'matrix', 'joined'];
257+
const types: Array<z.infer<typeof ReportType>> = ['tabular', 'summary', 'matrix', 'joined'];
258258

259259
types.forEach(type => {
260260
const report = ReportSchema.parse({

0 commit comments

Comments
 (0)