Skip to content

Commit 4455725

Browse files
committed
fix(enhanced-img): ensure ambient modules use ambient imports
Top-level imports and exports automatically upgrade a TypeScript file to the module context. This is not desired in `ambient.d.ts` because we want to keep this module ambient in order for the `declare module` to apply globally across all imports of `*?enhanced`. By importing the `Picture` type inside the ambient module context, we preserve the "ambient-ness" of the `ambient.d.ts` file. https://www.typescriptlang.org/docs/handbook/modules/reference.html#ambient-modules
1 parent ee81f76 commit 4455725

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import type { Picture } from 'vite-imagetools';
2-
31
declare module '*?enhanced' {
2+
import type { Picture } from 'vite-imagetools';
43
const value: Picture;
54
export default value;
65
}

0 commit comments

Comments
 (0)