powertools-lambda-typescript icon indicating copy to clipboard operation
powertools-lambda-typescript copied to clipboard

Feature request: add types for built-in schemas and envelopes

Open am29d opened this issue 1 year ago • 0 comments

Use case

When using zod schema we can extract type from the schema:

import { z } from 'zod';

const orderSchema = z.object({
  id: z.number().positive(),
  description: z.string(),
  items: z.array(orderItemSchema),
});

type Order = z.infer<typeof orderSchema>; 

We have created built-in schemas and envelopes but we did not extracted this types into dedicated package. If users want to use the types from the schema they need to write z.infer statement themselves. We can improve the experience by creating this types.

Solution/User Experience

Write a types file with alle the schema and envelopes types using z.infer

Alternative solutions

No response

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

am29d avatar Jan 05 '24 13:01 am29d