fix(plugin-fetch): avoid relying on global BodyInit in Node projects - #839
fix(plugin-fetch): avoid relying on global BodyInit in Node projects#839stijnvanhulle wants to merge 1 commit into
Conversation
The generated .kubb/client.ts and .kubb/serializers.ts referenced the global BodyInit type, which a Node-only project (@types/node without the dom lib) never declares. Both files now use a local RequestBody type derived from RequestInit['body'], which resolves the same way without requiring a global BodyInit name. plugin-axios shares the same serializers.ts template and gets the same fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H2LADp1sJjG9BQz5sQbsBX
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
◈ PR Lens
Architecture 8 components touched across 7 lanes. Data flow No data-flow sequence changed in this PR. Drill down
|
🦋 Changeset detectedLatest commit: eddfd39 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Size Change: 0 B Total Size: 312 kB ℹ️ View Unchanged
|
More templates
@kubb/plugin-axios
@kubb/plugin-cypress
@kubb/plugin-faker
@kubb/plugin-fetch
@kubb/plugin-mcp
@kubb/plugin-msw
@kubb/plugin-react-query
@kubb/plugin-redoc
@kubb/plugin-swr
@kubb/plugin-ts
@kubb/plugin-vue-query
@kubb/plugin-zod
commit: |
🎯 Changes
@kubb/plugin-fetchand@kubb/plugin-axiosemit generated client and serializer files that referenced the globalBodyInittype. A Node-only TypeScript project (@types/nodewithout thedomlibrary) declaresRequestInit,Request, andResponseglobally, but notBodyInit, so the generated code failed to type-check withCannot find name 'BodyInit'.Both templates now define a module-local
RequestBodytype derived fromRequestInit['body']and use it everywhereBodyInitwas referenced. This resolves the same wayBodyInitdid in a browser or full-domproject, but no longer depends on a global name a Node-only project doesn't declare.Fixes #833
Files changed
packages/plugin-fetch/templates/fetch.tsandtemplates/serializers.tspackages/plugin-axios/templates/serializers.ts(shares the same serializer template)tests/3.0.x/__snapshots__/andexamples/*/src/gen/.kubb/, refreshed to matchdocssubmodule'ssnippets/how-to/transport.mdupdated to match the new type name✅ Checklist
pnpm run test.🚀 Release Impact
🤖 Generated with Claude Code
https://claude.ai/code/session_01H2LADp1sJjG9BQz5sQbsBX
Generated by Claude Code