From d1f7143f9caf2ffa0e87cc55c0e05339d3501db3 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Mon, 14 Aug 2023 15:04:45 +0100 Subject: [PATCH] fix(astro): strongly type Astro.self (#7866) Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> Co-authored-by: Princesseuh --- .changeset/olive-queens-drum.md | 5 +++++ packages/astro/src/@types/astro.ts | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .changeset/olive-queens-drum.md diff --git a/.changeset/olive-queens-drum.md b/.changeset/olive-queens-drum.md new file mode 100644 index 000000000000..258d9c726367 --- /dev/null +++ b/.changeset/olive-queens-drum.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Add second type argument to the AstroGlobal type to type Astro.self. This change will ultimately allow our editor tooling to provide props completions and intellisense for `` diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index c2a7c38233d3..fd809e846615 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -139,8 +139,10 @@ export interface CLIFlags { * * [Astro reference](https://docs.astro.build/reference/api-reference/#astro-global) */ -export interface AstroGlobal = Record> - extends AstroGlobalPartial, +export interface AstroGlobal< + Props extends Record = Record, + Self = AstroComponentFactory +> extends AstroGlobalPartial, AstroSharedContext { /** * A full URL object of the request URL. @@ -217,7 +219,7 @@ export interface AstroGlobal = Record