-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
types(ModalSubmitInteraction): make attachments optional #11363
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 attachments field can be undefined when a user doesn't upload a file in an optional FileUpload component, but the types didn't reflect this possibility, causing runtime errors. close discordjs#11359
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code graph analysis (1)packages/discord.js/typings/index.d.ts (1)
🔇 Additional comments (1)
Comment |
Summary
Makes
FileUploadModalData.attachmentsoptional to match runtime behavior.Problem
When a modal has an optional
FileUploadcomponent and the user doesn't upload a file,component.attachmentsisundefinedat runtime. However, the TypeScript types marked it as required, causing no compile-time warning but runtime errors when accessing the property.Solution
Add
?to theattachmentsfield inFileUploadModalDatainterface:Closes #11359