-
Notifications
You must be signed in to change notification settings - Fork 780
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
Sendgrid with TypeScript > 4.4 #1344
Comments
This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog. |
Any update on this? Or potential mitigation? This is essentially blocking upgrading to TypeScript >=4.4 👀 |
Seems like I was able to work around this by importing and instantiating a import { send, setApiKey } from '@sendgrid/mail'
setApiKey(environment.sendgrid.apiKey)
// ...and usage...
await send(/* something *) doing it like import { MailDataRequired, MailService } from '@sendgrid/mail'
const SendGrid = new MailService()
SendGrid.setApiKey(environment.sendgrid.apiKey)
// ...and usage...
await SendGrid.send(/* something */) but please feel free to let me know if there's something wrong with this approach. Seems to work for TypeScript versions older and newer than 4.4.x. |
After some testing it indeed seems like my solution above works, so is this more a question of updating the documentation to reflect that as the correct way of doing things? 👀 |
Just got bit by this and it seems a pretty breaking issue for it to simply be backlogged. @anttispitkanen Thank you for the workaround |
Issue Summary
Updating typescript broke sendgrid because of the class instance export
When trying to set API key by calling 'setApiKey', it will fail because 'this' is undefined.
The issue is the result of this change in TypeScript:
https://devblogs.microsoft.com/typescript/announcing-typescript-4-4/#more-compliant-indirect-calls-for-imported-functions
Steps to Reproduce
Install sendgrid on an typescript > 4.4 environment
try to use sendgrid to send a mail
Technical details:
The text was updated successfully, but these errors were encountered: