diff options
author | 2022-03-03 12:34:04 -0500 | |
---|---|---|
committer | 2022-03-03 11:34:04 -0600 | |
commit | 519a5d84d141848817846fe9fd5f4d3e838cbc55 (patch) | |
tree | 0700a0d5b31795da9ddfbb0e4e6fb1a46fa0704b | |
parent | 5b1d7001340cb96f75243485eb0650c186d01bea (diff) | |
download | astro-519a5d84d141848817846fe9fd5f4d3e838cbc55.tar.gz astro-519a5d84d141848817846fe9fd5f4d3e838cbc55.tar.zst astro-519a5d84d141848817846fe9fd5f4d3e838cbc55.zip |
Add .d.ts file to astro package for language-tools consumption (#2711)
* Add .d.ts file for user and language-server consumption
* Update according to feedback
Diffstat (limited to '')
-rw-r--r-- | packages/astro/env.d.ts | 12 | ||||
-rw-r--r-- | packages/astro/package.json | 2 |
2 files changed, 14 insertions, 0 deletions
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 @@ +/// <reference types="vite/client" /> + +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<Astro>; + +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" ], |