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).
- Sanity Create
- Sanity Studio
- Workflows
- Project management
- Migration Cheat Sheet
- Step-by-step guide
- Command Line Interface (CLI)
- Studio configuration
- Workspaces
- Schema and schema types
- Structure Builder
- Initial Value Templates
- New Document Templates
- Production URL Resolver
- Document Actions and Badges
- Custom Auth Providers
- Plugins
- Custom Components
- Tools
- Environment variables
- Styling and branding
- Guides
- Core concepts
- Customization
- REFERENCE
- Onboarding stakeholders
- SANITY STUDIO
- CONTENT LAKE
- Command Line Interfaces
- Integration
Throw error on invalid image source
Image URL library
v1.0.0
Published September 01, 2021