mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
a397b981f5
* WIP: moving to a static .d.ts types file * fixing named exports for getImage and getPicture * removing the exports.astro map for now * WIP: adding readme docs for component attributes * Adding docs for getImage and getPicture * leaning fully on TSC to build .d.ts files * finally found the solution for proper ESM import types * adding a note to the README for tsconfig updates * chore: add changesets * typo * docs: removing the "Images in Markdown" example * removing the need for publishing src to NPM * fix: make type re-export explicit * updating image module defs to match InputFormat * using astro syntax highlighting for README code blocks * nit: missing backtick in README * make sure Astro component directives aren't recommended twice
55 lines
987 B
TypeScript
55 lines
987 B
TypeScript
type InputFormat =
|
|
| 'avif'
|
|
| 'gif'
|
|
| 'heic'
|
|
| 'heif'
|
|
| 'jpeg'
|
|
| 'jpg'
|
|
| 'png'
|
|
| 'tiff'
|
|
| 'webp';
|
|
|
|
interface ImageMetadata {
|
|
src: string;
|
|
width: number;
|
|
height: number;
|
|
format: InputFormat;
|
|
}
|
|
|
|
// images
|
|
declare module '*.avif' {
|
|
const metadata: ImageMetadata;
|
|
export default metadata;
|
|
}
|
|
declare module '*.gif' {
|
|
const metadata: ImageMetadata;
|
|
export default metadata;
|
|
}
|
|
declare module '*.heic' {
|
|
const metadata: ImageMetadata;
|
|
export default metadata;
|
|
}
|
|
declare module '*.heif' {
|
|
const metadata: ImageMetadata;
|
|
export default metadata;
|
|
}
|
|
declare module '*.jpeg' {
|
|
const metadata: ImageMetadata;
|
|
export default metadata;
|
|
}
|
|
declare module '*.jpg' {
|
|
const metadata: ImageMetadata;
|
|
export default metadata;
|
|
}
|
|
declare module '*.png' {
|
|
const metadata: ImageMetadata;
|
|
export default metadata;
|
|
}
|
|
declare module '*.tiff' {
|
|
const metadata: ImageMetadata;
|
|
export default metadata;
|
|
}
|
|
declare module '*.webp' {
|
|
const metadata: ImageMetadata;
|
|
export default metadata;
|
|
}
|