From 91c2e7f959418d71e26e5b9a6723fed2944001d9 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Tue, 17 Jan 2023 17:44:52 -0800 Subject: [PATCH] Fix TypeScript types * Change NavigationInterceptOptions's handler to return Promise instead of Promise. 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. --- navigation_api.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/navigation_api.d.ts b/navigation_api.d.ts index 1298318..4feccd7 100644 --- a/navigation_api.d.ts +++ b/navigation_api.d.ts @@ -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; @@ -129,7 +129,7 @@ interface NavigateEventInit extends EventInit { } interface NavigationInterceptOptions { - handler?: () => Promise, + handler?: () => Promise, focusReset?: "after-transition"|"manual", scroll?: "after-transition"|"manual" }