From 60210fe58722cd1a017ce2a5e993c5a25f1fe283 Mon Sep 17 00:00:00 2001 From: blt_r Date: Thu, 29 Jan 2026 21:41:22 +0400 Subject: [PATCH 1/3] feat: export type Picture in enhanced-img This type is part of public api, so it should be reexported. Otherwise users have to explicitly add "vite-imagetools", or use hacks like `typeof import('fake.jpg?enhanced').default` This type is needed when using `import.meta.glob`, because by default it is getting typed as `unknown`. --- .changeset/tired-papayas-cough.md | 5 +++++ packages/enhanced-img/types/index.d.ts | 2 ++ 2 files changed, 7 insertions(+) create mode 100644 .changeset/tired-papayas-cough.md diff --git a/.changeset/tired-papayas-cough.md b/.changeset/tired-papayas-cough.md new file mode 100644 index 000000000000..907eb4d946f7 --- /dev/null +++ b/.changeset/tired-papayas-cough.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/enhanced-img': minor +--- + +feat: export type Picture diff --git a/packages/enhanced-img/types/index.d.ts b/packages/enhanced-img/types/index.d.ts index 5d287fc672d6..c3181d523960 100644 --- a/packages/enhanced-img/types/index.d.ts +++ b/packages/enhanced-img/types/index.d.ts @@ -3,6 +3,8 @@ import type { Plugin } from 'vite'; import type { Picture } from 'vite-imagetools'; import './ambient.js'; +export type { Picture } from 'vite-imagetools'; + type EnhancedImgAttributes = Omit & { src: string | Picture }; // https://svelte.dev/docs/svelte/typescript#enhancing-built-in-dom-types From dafa89612471a89227f6792cf4f8699b60a59ce4 Mon Sep 17 00:00:00 2001 From: Elliott Johnson Date: Fri, 30 Jan 2026 16:29:38 -0700 Subject: [PATCH 2/3] Apply suggestion from @teemingc Co-authored-by: Tee Ming --- .changeset/tired-papayas-cough.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/tired-papayas-cough.md b/.changeset/tired-papayas-cough.md index 907eb4d946f7..03a4055cdc7b 100644 --- a/.changeset/tired-papayas-cough.md +++ b/.changeset/tired-papayas-cough.md @@ -2,4 +2,4 @@ '@sveltejs/enhanced-img': minor --- -feat: export type Picture +feat: re-export the `Picture` type from `vite-imagetools` From c5f87db366fcc014df9f5ebb8e6f37bbbb48f7c3 Mon Sep 17 00:00:00 2001 From: Elliott Johnson Date: Fri, 30 Jan 2026 16:29:48 -0700 Subject: [PATCH 3/3] tweak --- packages/enhanced-img/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/enhanced-img/types/index.d.ts b/packages/enhanced-img/types/index.d.ts index c3181d523960..2cbf253e4e03 100644 --- a/packages/enhanced-img/types/index.d.ts +++ b/packages/enhanced-img/types/index.d.ts @@ -3,7 +3,7 @@ import type { Plugin } from 'vite'; import type { Picture } from 'vite-imagetools'; import './ambient.js'; -export type { Picture } from 'vite-imagetools'; +export { Picture }; type EnhancedImgAttributes = Omit & { src: string | Picture };