Sendgrid-nodejs: typescript definitions errors

Created on 17 Nov 2017  路  6Comments  路  Source: sendgrid/sendgrid-nodejs

Issue Summary

This package prevents typescript to work correctly due to problems with typescript definitions.

node_modules/@sendgrid/client/src/client.d.ts(37,10): error TS2714: The expression of an export assignment must be an identifier or qualified name in an ambient context.
node_modules/@sendgrid/helpers/classes/email-address.d.ts(11,3): error TS7010: 'fromData', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/@sendgrid/helpers/classes/email-address.d.ts(16,3): error TS7010: 'setName', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/@sendgrid/helpers/classes/email-address.d.ts(21,3): error TS7010: 'setEmail', which lacks return-type annotation, implicitly has an 'any' return type.
node_modules/@sendgrid/mail/src/mail.d.ts(33,10): error TS2714: The expression of an export assignment must be an identifier or qualified name in an ambient context.

Steps to Reproduce

  1. Install latest typescript
  2. Install latest @sendgrid/mail
  3. Set up a strict typescript environment

Technical details:

  • sendgrid-nodejs Version: 6.1.4
  • Node.js Version: 9.1
  • TypeScript: 2.6.1
work in progress bug

All 6 comments

Please I need this fix ASAP!

@demian85 in the mean time you can fork the repo, make the above fixes and them do your npm install from your master branch of the forked repo.

@nitish24p he can just point to my fork without creating another one..

Thanks @nitish24p and @phra for providing a temporary fix until we get this merged.

@demian85,

Did their solution work for you?

Well, not really. It's really a mindfuck for me to have slashes in the import route.
After adding dependency as yarn add phra/sendgrid-nodejs#89b988a61d0b3e8b9d19e261b3f3f9880c20f16e, I keep getting src/server/emails/emailer.ts(5,25): error TS2307: Cannot find module 'sendgrid'.
I just want the email package, but I'm not sure what I'm getting when importing...

import mailer = require('sendgrid/mail'); // what? where is mail?
import { MailData } from 'sendgrid/helpers/classes/mail'; // how to import this type?

I'd appreciate any help!

@demian85 quick fix is to try the following:
import mailer = require('@sendgrid/mail'); // tslint:disable-line
but the library is broken right now with TS 2.6 (see #619)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thinkingserious picture thinkingserious  路  4Comments

thinkingserious picture thinkingserious  路  4Comments

wooyah picture wooyah  路  4Comments

prasoonjalan picture prasoonjalan  路  3Comments

umarhussain15 picture umarhussain15  路  3Comments