👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect
Back to changelog

Throw error on invalid image source

Previously, the @sanity/image-url library would return `null` if you passed an invalid source (such as an object without the expected properties, or an invalid image asset ID). From 1.0.0 and onwards, the library will throw when receiving an invalid source. This makes it more obvious when there is invalid data passed to it, as well as ensuring that the function always returns a string (which is a much requested feature for TypeScript users).

Published September 01, 2021