diff --git a/.changeset/unlucky-dragons-end.md b/.changeset/unlucky-dragons-end.md new file mode 100644 index 00000000..4656b684 --- /dev/null +++ b/.changeset/unlucky-dragons-end.md @@ -0,0 +1,5 @@ +--- +'@inox-tools/astro-when': patch +--- + +Inject types in `.astro` folder structure if the utility is available diff --git a/packages/astro-when/src/index.ts b/packages/astro-when/src/index.ts index 1402e5cc..6da39597 100644 --- a/packages/astro-when/src/index.ts +++ b/packages/astro-when/src/index.ts @@ -68,6 +68,16 @@ export default defineIntegration({ }, }); }, + 'astro:config:done': (params) => { + // Check if the version of Astro being used has the `injectTypes` utility. + if (typeof params.injectTypes === 'function') { + debug('Injecting types in .astro structure'); + params.injectTypes({ + filename: 'types.d.ts', + content: "import '@inox-tools/astro-when';", + }); + } + }, }, }), });