-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(types): support custom VitePreloadErrorEvent #17615
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Would it also be relevant to cast the actual error being thrown in https://github.com/vitejs/vite/blob/main/packages/vite/src/node/plugins/importAnalysisBuild.ts#L148 Doing something like this in the const e: VitePreloadErrorEvent = new Event('vite:preloadError', { cancelable: true })
e.payload = err
window.dispatchEvent(e)
if (!e.defaultPrevented) {
throw err
} I think that will also make it possible to remove the |
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
As @MathiasWP said, do you think we need to customize a |
Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
If it's possible to cast then that would be great, but I don't know if there's complications doing that when the types come from |
The type is not complicated, it is simpler to just declare one. |
Feedback for whoever, in typescript this makes is more complicated to spyOn as there is now a colliding overload. |
Description
close #17508