-
Notifications
You must be signed in to change notification settings - Fork 778
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
Unable to Instantiate a new Client class #986
Comments
Also encountering this issue. Very frustrating for Typescript users. Currently working around it with this nasty hack: import { Client } from "@sendgrid/client";
import { ISendgridAccount } from "./ISendgridAccount";
const SGClient: any = Client;
export class SendgridClient {
private client: typeof Client;
constructor(account: ISendgridAccount) {
this.client = new SGClient();
this.client.setApiKey('');
}
} |
We also need support for creating new instance of SendGrid/Mail fo a new API key. In Nodejs modules are singleton objects, so setApiKey would not work as it would cause race around conditions when multiple API keys are used. |
I just ran into this problem as well. Would be great to get a fix. I'm pretty sure the problem is that this line:
Should instead read:
|
PR submitted to fix this. |
Issue Summary
Currently I'm able to manually create client instances in javascript, but am not able to do so in Typescript.
Steps to Reproduce
Error : Cannot use 'new' with an expression whose type lacks a call or construct signature.
Technical details:
@sendgrid/client
Version: 6.4.0Node.js
Version: 10.16.3The text was updated successfully, but these errors were encountered: