-
-
Notifications
You must be signed in to change notification settings - Fork 243
Remove BodyInit DOM dependency by casting to any #2655
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
Co-authored-by: mrlubos <[email protected]>
@copilot this can be done much simpler. We don't need to create our own RequestBody type at all. I think you can modify the type casting you touched in your initial commit such that it passes type checks and doesn't require RequestBody, since that's the only place we're using that type. |
Co-authored-by: mrlubos <[email protected]>
You're absolutely right! I've simplified the approach by removing the custom RequestBody type entirely and just casting |
@copilot this looks good but you forgot to update snapshots |
Co-authored-by: mrlubos <[email protected]>
@copilot can you figure out how to resolve this issue by removing the type casting altogether? Some people might have linter configured such that using |
Great suggestion! I've eliminated the type casting altogether by restructuring the code. Instead of |
Co-authored-by: mrlubos <[email protected]>
opts.body as any
toconst { body, ...sseOpts } = opts;
and spreading only compatible propertiesany
casts or BodyInit references remain in generated codeFinal Solution:
Instead of casting the body to
any
or creating custom types, the fix now completely avoids the type compatibility issue by destructuring thebody
property out of the options object before passing it tocreateSseClient
. SincecreateSseClient
usesserializedBody
internally and doesn't need the originalbody
property, this approach eliminates all type casting while maintaining full functionality.Changes Made:
const { body, ...sseOpts } = opts;
followed by...sseOpts
in createSseClient callTesting:
any
typeThis approach completely eliminates the DOM dependency while avoiding any use of
any
type that could trigger linter errors.Fixes #2539.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.