Node.js SDK - TypeScript error

Hi! We are migrating part of our code base to ESM modules and we are getting a TS error saying :

This expression is not constructable"
Type ’ type of …/node_modules/lig/types/nylas’ has no construct signatures.

It seems to have no bad side effects based on our tests so far but it’s a bit a scary error. We are using TypeScript 5.5.3 (tried 5.7.3 with no luck) and Nylas SDK 7.7.4.

Sample code:
import Nylas from ‘nylas’;

const client = new Nylas(
{ apiKey: NylasConfig.apiKey, apiUri: NylasConfig.apiUri }
);

@wander thanks for posting, the code sample seems to be correct based on our docs:

import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>"
})   

Let me take this back to the team to take a look at - but to confirm, this does not impact functionality, just generated a TS error?

As far as we can tell (e.g. up to the point we tested things) it seems to not affect functionality. So far it seems to be just a TS type error that does not translate into the JS level.

1 Like