javascript
javascript copied to clipboard
Fix return types for backend resource deletions
Description
When deleting resources, for example an Organization, the backend client is typed to return Organization, whereas the actual HTTP API returns a DeletedObject, resulting in a type mismatch. This PR:
- updates
DeletedObjectJSONto accept a generic that extendsstring, with a default ofstring- i initially wanted this to extend
ObjectTypebut then that would breakDeletedObject.fromJSON()
- i initially wanted this to extend
- changes the generics passed into
this.request()for the following resource delete methods:AllowlistDomainEmailAddressOrganizationPhoneNumberRedirectUrlSamlConnection- for this one i'm just assuming
ObjectType.SamlAccountis the correct type, as there's noSamlConnection
- for this one i'm just assuming
User
I'm not sure what the convention would be for handling this DeletedObjectJSON type property so this just seemed like the most straight forward way that wouldn't break anything 😅
Checklist
- [x]
npm testruns as expected. - [x]
npm run buildruns as expected. - [ ] (If applicable) JSDoc comments have been added or updated for any package exports
- [ ] (If applicable) Documentation has been updated
Type of change
- [x] 🐛 Bug fix
- [ ] 🌟 New feature
- [ ] 🔨 Breaking change
- [ ] 📖 Refactoring / dependency upgrade / documentation
- [ ] other: