diff --git a/packages/astro/env.d.ts b/packages/astro/env.d.ts new file mode 100644 index 000000000..88a4bcce3 --- /dev/null +++ b/packages/astro/env.d.ts @@ -0,0 +1,12 @@ +/// + +type Astro = import('./dist/types/@types/astro').AstroGlobal; + +// We duplicate the description here because editors won't show the JSDoc comment from the imported type (but will for its properties, ex: Astro.request will show the AstroGlobal.request description) +/** + * Astro.* available in all components + * Docs: https://docs.astro.build/reference/api-reference/#astro-global + */ +declare const Astro: Readonly; + +declare const Fragment: any; diff --git a/packages/astro/package.json b/packages/astro/package.json index dde380791..63c19bf73 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -15,6 +15,7 @@ "types": "./dist/types/@types/astro.d.ts", "exports": { ".": "./astro.js", + "./env": "./env.d.ts", "./app/node": "./dist/core/app/node.js", "./client/*": "./dist/runtime/client/*", "./components": "./components/index.js", @@ -44,6 +45,7 @@ "components", "dist", "astro.js", + "env.d.ts", "README.md", "vendor" ],