Skip to content

Commit

Permalink
Adds auto completion of astro: events when adding or removing event…
Browse files Browse the repository at this point in the history
… listeners on `document`
  • Loading branch information
martrapp committed Feb 28, 2024
1 parent 9b00de0 commit ef9c5b1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-worms-rush.md
@@ -0,0 +1,5 @@
---
"astro": patch
---

Adds auto completion for `astro:` event names when adding or removing event listeners on `document`.
12 changes: 9 additions & 3 deletions packages/astro/src/@types/astro.ts
Expand Up @@ -36,6 +36,7 @@ import type {
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js';
import type { DeepPartial, OmitIndexSignature, Simplify } from '../type-utils.js';
import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
import type { TransitionBeforePreparationEvent, TransitionBeforeSwapEvent } from '../transitions/events.js';

export { type AstroIntegrationLogger };

Expand Down Expand Up @@ -2831,11 +2832,16 @@ declare global {
'astro-dev-overlay-icon': DevToolbarIcon;
'astro-dev-overlay-card': DevToolbarCard;
}
}

declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Config {
type Database = Record<string, any>;
}

interface DocumentEventMap {
'astro:before-preparation': TransitionBeforePreparationEvent;
'astro:after-preparation': Event;
'astro:before-swap': TransitionBeforeSwapEvent;
'astro:after-swap': Event;
'astro:page-load': Event;
}
}

0 comments on commit ef9c5b1

Please sign in to comment.