being a Typescript rookie, I am trying to type everything as precisely as possible as a part of the learning process.
I have a lqip
(low quality image placeholder) property coming from a CMS which should be a base64 encoded image. It is clearly a string, but typing it as a string feels kind of imprecise.
mainImage: Schema.Post["mainImage"] & {
// can I be more precise? It should be always a base64 encoded image, not just a generic string…
// e.g. "data:image/jpeg;base64,/9j/2wBDAAYEB…"
lqip: string
}
Is there a type for base64 encoded image in Typescript? I've tried to google extensively, but I've found only topics regarding atob
/btoa
conversions, not the type itself. Thanks!