Skip to content

Commit

Permalink
Fix TypeScript types
Browse files Browse the repository at this point in the history
* Change NavigationInterceptOptions's handler to return Promise<void> instead of Promise<undefined>. The latter is a little awkward, requiring an explicit `return undefined` at times.

* Make info optional on NavigateEvent, to reflect that it is sometimes undefined.
  • Loading branch information
atscott authored Jan 18, 2023
1 parent 2e1cd55 commit 91c2e7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions navigation_api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ declare class NavigateEvent extends Event {
readonly signal: AbortSignal;
readonly formData: FormData|null;
readonly downloadRequest: string|null;
readonly info: unknown;
readonly info?: unknown;

intercept(options?: NavigationInterceptOptions): void;
scroll(): void;
Expand All @@ -129,7 +129,7 @@ interface NavigateEventInit extends EventInit {
}

interface NavigationInterceptOptions {
handler?: () => Promise<undefined>,
handler?: () => Promise<void>,
focusReset?: "after-transition"|"manual",
scroll?: "after-transition"|"manual"
}
Expand Down

0 comments on commit 91c2e7f

Please sign in to comment.