summaryrefslogtreecommitdiff
path: root/tools/language-server/astro.d.ts
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@matthewphillips.info> 2021-08-10 09:30:02 -0400
committerGravatar GitHub <noreply@github.com> 2021-08-10 09:30:02 -0400
commit2c5380a26631f720bfbbcec78295c71b562e647d (patch)
tree40ead718c2d817265a8d40bb04d099aae507c4a7 /tools/language-server/astro.d.ts
parent1339d5e36bdaae1eeea6bf9d99b2bdf4d69d604a (diff)
downloadastro-2c5380a26631f720bfbbcec78295c71b562e647d.tar.gz
astro-2c5380a26631f720bfbbcec78295c71b562e647d.tar.zst
astro-2c5380a26631f720bfbbcec78295c71b562e647d.zip
Add support for Astro.* completion and Hover help (#1068)
* Add support for Astro.* completion and Hover help * Allow providing a generic type to fetchContent
Diffstat (limited to 'tools/language-server/astro.d.ts')
-rw-r--r--tools/language-server/astro.d.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/language-server/astro.d.ts b/tools/language-server/astro.d.ts
new file mode 100644
index 000000000..267f6f108
--- /dev/null
+++ b/tools/language-server/astro.d.ts
@@ -0,0 +1,27 @@
+type AstroRenderedHTML = string;
+
+type FetchContentResult<ContentFrontmatter extends Record<string, any> = Record<string, any>> = {
+ astro: {
+ headers: string[];
+ source: string;
+ html: AstroRenderedHTML;
+ };
+ url: URL;
+} & ContentFrontmatter;
+
+interface AstroPageRequest {
+ url: URL;
+ canonicalURL: URL;
+}
+
+interface Astro {
+ isPage: boolean;
+ fetchContent<ContentFrontmatter>(globStr: string): FetchContentResult<ContentFrontmatter>[];
+ props: Record<string, number | string | any>;
+ request: AstroPageRequest;
+ site: URL;
+}
+
+declare const Astro: Astro;
+
+export default function(): string; \ No newline at end of file