You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vite has a vite:preloadErrorcustom event which can be used when loading a dynamic import fails.
This event is not declared in the global namespace, so doing
window.addEventListener('vite:preloadError',(event)=>{event.payload// Property 'payload' does not exist on type 'Event'.})
or
// Argument of type '(event: Event & { payload: Error; }) => void' is not assignable to parameter of type 'EventListenerOrEventListenerObjectwindow.addEventListener('vite:preloadError',(event: Event&{payload: Error})=>{event.payload})
Description
Vite has a
vite:preloadError
custom event which can be used when loading a dynamic import fails.This event is not declared in the global namespace, so doing
or
will not work unless you override the event type.
Suggested solution
Declare the event in a global namespace:
Alternative
Adding this declaration to my own
vite.d.ts
file, but it feels like something Vite should export since the library knows the exact type.Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: