Lessons from open-source: Typesafe “getInt” utility function in Next.js source code
This lesson is picked from Next.js source code. In this article, you will learn what a high quality getInt util function looks like, especially the edge case to handle infinite numbers. getInt You will find the following at shared/lib/get-img-props.ts function...