diff --git a/src/pages/en/guides/typescript.md b/src/pages/en/guides/typescript.md index 0daf1b416a63f..b51c7ae0716d1 100644 --- a/src/pages/en/guides/typescript.md +++ b/src/pages/en/guides/typescript.md @@ -110,6 +110,16 @@ declare namespace astroHTML.JSX { } ``` +:::note +`astroHTML` is injected globally inside `.astro` components. To use it in TypeScript files, use a [triple-slash directive](https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html): + +```ts +/// + +type MyAttributes = astroHTML.JSX.ImgHTMLAttributes; +``` +::: + ## Type checking To see type errors in your editor, please make sure that you have the [Astro VS Code extension](/en/editor-setup/) installed. Please note that the `astro start` and `astro build` commands will transpile the code with esbuild, but will not run any type checking. To prevent your code from building if it contains TypeScript errors, change your "build" script in `package.json` to the following: