Luca Del Puppo - Full Stack Developer
@puppo92
Luca Del Puppo
Love sport: running, hiking
Love animals
@puppo92
interface CustomerModel {
id: number;
name: string;
email: string;
phone: string;
}
@puppo92
type CustomerModel = {
id: number;
name: string;
email: string;
phone: string;
};
@puppo92
@puppo92
HTTP Request
@puppo92
@puppo92
Zod is your superhero
import { z } from ‘zod’;
const CustomerSchema = z.object({
id: z.number(),
name: z.string(),
email: z.string(),
phone: z.string(),
});
@puppo92
import { TypeOf } from ‘zod';
type CustomerModel = TypeOf<typeof CustomerSchema>;
@puppo92
const res = CustomerSchema.parse({
id: 1,
name: 'John Doe',
email: 'john@doe.com',
phone: '555-555-5555'
});
@puppo92
@puppo92
@puppo92
Create a layer between your app and the outside
Validation
@puppo92
@puppo92
Code
Slides
@puppo92
Luca Del Puppo
Puppo_92
@puppo