sendgrid-nodejs
sendgrid-nodejs copied to clipboard
Type inconsistency: replyToList accepts EmailJSON | EmailJSON[] in types but requires EmailJSON[] at runtime
Problem
There's a type inconsistency in the Mail class regarding replyToList:
Type Definition suggests both formats are valid: https://github.com/sendgrid/sendgrid-nodejs/blob/2bac86884f71be3fb19f96a10c02a1fb616b81fc/packages/helpers/classes/mail.d.ts#L168
But, Runtime Validation enforces array-only: https://github.com/sendgrid/sendgrid-nodejs/blob/2bac86884f71be3fb19f96a10c02a1fb616b81fc/packages/helpers/classes/mail.d.ts#L372
https://github.com/sendgrid/sendgrid-nodejs/blob/2bac86884f71be3fb19f96a10c02a1fb616b81fc/packages/helpers/classes/mail.js#L679
Impact
This inconsistency causes runtime errors
Error: Array expected for replyToList