mirror of
https://github.com/withastro/astro.git
synced 2025-02-03 22:29:08 -05:00
fix(astro): strongly type Astro.self (#7866)
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com> Co-authored-by: Princesseuh <princssdev@gmail.com>
This commit is contained in:
parent
afc45af202
commit
d1f7143f9c
2 changed files with 10 additions and 3 deletions
5
.changeset/olive-queens-drum.md
Normal file
5
.changeset/olive-queens-drum.md
Normal file
|
@ -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 `<Astro.self />`
|
|
@ -139,8 +139,10 @@ export interface CLIFlags {
|
||||||
*
|
*
|
||||||
* [Astro reference](https://docs.astro.build/reference/api-reference/#astro-global)
|
* [Astro reference](https://docs.astro.build/reference/api-reference/#astro-global)
|
||||||
*/
|
*/
|
||||||
export interface AstroGlobal<Props extends Record<string, any> = Record<string, any>>
|
export interface AstroGlobal<
|
||||||
extends AstroGlobalPartial,
|
Props extends Record<string, any> = Record<string, any>,
|
||||||
|
Self = AstroComponentFactory
|
||||||
|
> extends AstroGlobalPartial,
|
||||||
AstroSharedContext<Props> {
|
AstroSharedContext<Props> {
|
||||||
/**
|
/**
|
||||||
* A full URL object of the request URL.
|
* A full URL object of the request URL.
|
||||||
|
@ -217,7 +219,7 @@ export interface AstroGlobal<Props extends Record<string, any> = Record<string,
|
||||||
*
|
*
|
||||||
* [Astro reference](https://docs.astro.build/en/guides/api-reference/#astroself)
|
* [Astro reference](https://docs.astro.build/en/guides/api-reference/#astroself)
|
||||||
*/
|
*/
|
||||||
self: AstroComponentFactory;
|
self: Self;
|
||||||
/** Utility functions for modifying an Astro component’s slotted children
|
/** Utility functions for modifying an Astro component’s slotted children
|
||||||
*
|
*
|
||||||
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#astroslots)
|
* [Astro reference](https://docs.astro.build/en/reference/api-reference/#astroslots)
|
||||||
|
|
Loading…
Add table
Reference in a new issue