SShortSingh.
Back to feed

Why Your TypeScript Code Still Crashes in Production: Validating Data at Runtime Boundaries with Zod

0
·1 views

Mình từng review một incident lúc 2 giờ sáng: service Node.js crash hàng loạt với lỗi TypeError: Cannot read properties of undefined (reading 'toFixed'). Codebase 100% TypeScript, bật strict: true, CI xanh, không có any nào. Vậy mà vẫn sập. Nguyên nhân là bên đối tác đổi field price từ number sang string "12.50", và có record thì trả về null. TypeScript không hề biết chuyện này, vì type chỉ tồn tại lúc compile, còn data thật đến lúc runtime.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Mejores gadgets con inteligencia artificial dispositivos útiles

Mejores gadgets con inteligencia artificial y dispositivos útiles son conceptos que por fin coinciden tras dos años de fiascos comerciales ruidosos. Por ejemplo, el intento fallido de sustituir al teléfono móvil mediante broches magnéticos que proyectaban rayos láser sobre la piel o cajitas naranjas con ruedas mecánicas terminó en cancelaciones corporativas y cajones llenos de polvo. Quienes compran tecnología en la actualidad buscan periféricos especializados que resuelvan fricciones concretas. Por ejemplo: capturar reuniones sin tomar apuntes, traducir carteles en tiempo real sin sacar el te

0
ProgrammingDEV Community ·

Run, Hunt, Hack: Join the Cloud Run Hackathon on Product Hunt

Got a cool side project running on your local machine? This is your chance to make it live and have the chance to win cool prizes while you do it with the Google Cloud Run Hackathon on Product Hunt on Wednesday, October 14th. Never used Cloud Run before? It’s easy! Simply deploy your project with one simple command, and let Cloud Run handle all of the infrastructure for you, automatically scaling based on how much traffic your app is getting.

0
ProgrammingDEV Community ·

What I Wish I Knew Before I Started My Programming Journey

All the things I'll say in this post are based on my past experiences with beginners (including myself). The information I display is not applicable to every beginner, nor is it applicable to only beginners. There are a lot of types of people beginning to code. The one I'm targeting is the 'ambitious' developer. This person wants to create massive and complex projects, even when they just started coding.