Skip to content

Commit 84effd8

Browse files
authored
fix(src/integration.ts): loose type for compatibility with other astro versions (#185)
1 parent 2688196 commit 84effd8

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/integration.ts

+23-13
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AstroIntegration } from "astro";
1+
import type { AstroIntegration, AstroIntegrationLogger } from "astro";
22
import { betterImageService } from "./config.js";
33

44
/**
@@ -8,16 +8,26 @@ import { betterImageService } from "./config.js";
88
*/
99
export const astroIntegration = (
1010
config?: Parameters<typeof betterImageService>[0],
11-
): AstroIntegration => ({
12-
name: "astro-better-image-service",
13-
hooks: {
14-
"astro:config:setup": ({ updateConfig, logger }) => {
15-
updateConfig({
16-
image: {
17-
service: betterImageService(config),
18-
},
19-
});
20-
logger.info("Image service entrypoint set.");
11+
) =>
12+
// loose type for compatibility with other astro versions
13+
({
14+
name: "astro-better-image-service",
15+
hooks: {
16+
"astro:config:setup": ({
17+
updateConfig,
18+
logger,
19+
}: {
20+
updateConfig: (config: {
21+
image: { service: ReturnType<typeof betterImageService> };
22+
}) => unknown;
23+
logger: AstroIntegrationLogger;
24+
}) => {
25+
updateConfig({
26+
image: {
27+
service: betterImageService(config),
28+
},
29+
});
30+
logger.info("Image service entrypoint set.");
31+
},
2132
},
22-
},
23-
});
33+
}) as const satisfies AstroIntegration;

0 commit comments

Comments
 (0)