-
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
Add TypeScript typings definition file for v3 API #251
Add TypeScript typings definition file for v3 API #251
Conversation
Hey guys, just noticed that all the built in unit tests failed with a 401 error - suspecting that has something to do with your test suite environment variables as I haven't touched anything on that front - however if there's anything you'd like me to look at, please don't hesitate to ask. |
Hey guys, any word on whether this'll get included or whether I should instead be investigating other approaches to publishing it? Still having to hack our way around the lack of a usable type definition from any official source. |
Hello @spartan563, It's still on our backlog and we plan to merge it. The only way this can move up our backlog queue is through +1's or comments on this thread. Thanks for checkin in! |
I see, not a problem at all so long as there's a process in place - let me know if you need anything from me at any point and I'll do my best to help out. |
I too am writing an application in TypeScript and also need to use SendGrid. It's not that it's impossible to use without the Definition file, but it does become much harder as one has to constantly check on documentation instead of getting intellisense (in visual studio code) completions. |
Thanks for the upvote @CelsoSantos, it helps move this issue up our queue. |
Hi @spartan563, Could you please resolve the conflicts so that I may test and merge? Thanks! |
596ea71
to
3b982fd
Compare
Hi @thinkingserious, should be up to date, rebased on |
@spartan563 please email us at [email protected] with your T-shirt size and mailing address :) |
Hey @spartan563 thanks for adding this to the lib, I LOVE it when modules have type definitions in their core. 🙌 I'm having a problem when trying to use this module in my TypeScript project. I'm receiving this error when exporting a This is a repro: import { SendGrid } from 'sendgrid';
import * as SG from 'sendgrid'; // This is what we usually do to try squash the error, it doesn't work in this scenario :(
const sendGrid = SendGrid(process.env.SENDGRID_API_KEY);
// ^^^^^^^^ error here
export default sendGrid; And since 🙏 🙌 Any help would be greatly appreciated, don't make us fall back to |
Hi @frederickfogerty, just spun up an essentially empty project and wasn't able to reproduce the issue you're describing. I've put down the example code you gave me in a quick repo which demonstrates this, if you could please fork it and make any changes necessary on your side to reproduce the issue then I'd be more than willing to look into it further. Repo: https://github.com/SPARTAN563/sendgrid-ts-demo Regards, |
Hey @spartan563, thanks for taking a look at my issue, I really appreciate it. I have submitted a PR to your repo which reproduces the issue: notheotherben/sendgrid-ts-demo#1 Thanks! |
See sendgrid#251 and <notheotherben/sendgrid-ts-demo#1> for more details on what wasn't working
Could the issue be that you are using |
Hey @thinkingserious, thanks for looking at my issue. By using i.e. this wouldn't compile import { SendGrid } from 'sendgrid';
import * as SG from 'sendgrid'; // This is what we usually do to try squash the error, it doesn't work in this scenario :(
const SendGrid = SendGrid(process.env.SENDGRID_API_KEY);
// ^^^^^^^^ error here
export default SendGrid; |
See sendgrid#251 and <notheotherben/sendgrid-ts-demo#1> for more details on what wasn't working
Hi guys,
Recently updated an application of ours to use your 3.0.0 library and noticed there weren't any up to date typings files in the wild. Seeing as the current approach with TypeScript is to embed these definition files in their respective NPM modules, I've taken the time to put together a compatible set of type definitions for your library.
In addition to adding the raw type definitions, I've also taken the liberty of adding a quick test that ensures the definition file is well formatted, it should help ensure that things aren't broken accidentally going forward.
As far as manual verification of the typings file goes, aside from running your unit test suites through the TypeScript compiler to confirm that they comply with the typings file (always a good way to ensure the types match what's expected), we're also running these typings on a production system with no issues as yet.
I'll ensure I sign the contributor license agreement and get that through to you guys, in the mean time if you wouldn't mind taking a look and letting me know if there's anything that stands out as being incorrect, or raising any issues you may have with this addition to the codebase.
Things that may be issues
Kind regards and all the best,
Benjamin