WICG / navigation-api

The new navigation API provides a new interface for navigations and session history, with a focus on single-page application navigations.
https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigation-api
484 stars 30 forks source link

Fix/update Typescript types #258

Closed atscott closed 1 year ago

atscott commented 1 year ago

Commit 1:

refactor(types): NavigationInterceptOptions handler should return Promise

Having the handler a Promise<undefined> makes it a little awkward to implement, requiring an explicit return undefined at times.

Promise<void> allows for omitting an explicit return when using an async function.

Example

Commit 2

fix(types): Make info optional on NavigateEvent

I believe info should be optional on the NavigateEvent given that it is optional in the NavigateEventInit and my experimentation revealed that it is indeed undefined if not set in the NavigationNavigateOptions.