Skip to content
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

missing static method when using "import" in typescript #457

Closed
ianzone opened this issue Apr 20, 2023 · 6 comments · Fixed by #477
Closed

missing static method when using "import" in typescript #457

ianzone opened this issue Apr 20, 2023 · 6 comments · Fixed by #477
Labels

Comments

@ianzone
Copy link

ianzone commented Apr 20, 2023

Describe the bug
Nylas.config() is undefined, when using import Nylas from 'nylas'

Nylas.config({ clientId: '', clientSecret: '' });
      ^
TypeError: Cannot read properties of undefined (reading 'config')
    at Object.<anonymous> (/home/ian/acte/roomzz-v1/api/booking/test.ts:3:7)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module.m._compile (/home/ian/.local/share/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:1618:23)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Object.require.extensions.<computed> [as .ts] (/home/ian/.local/share/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/index.ts:1621:12)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at phase4 (/home/ian/.local/share/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/bin.ts:649:14)
    at bootstrap (/home/ian/.local/share/pnpm/global/5/.pnpm/[email protected]_@[email protected][email protected]/node_modules/ts-node/src/bin.ts:95:10)

To Reproduce
in test.ts

import Nylas from 'nylas';

Nylas.config({ clientId: '', clientSecret: '' });

then run ts-node test.ts

SDK Version:
6.10.0

@ianzone ianzone added the bug label Apr 20, 2023
@relaxedtomato
Copy link
Contributor

Hi @ianzone, does the following syntax work?

const Nylas = require('nylas');

@relaxedtomato
Copy link
Contributor

Just to clarify, we support CommonJS modules

@ianzone
Copy link
Author

ianzone commented Apr 20, 2023

Hi @ianzone, does the following syntax work?

const Nylas = require('nylas');

It does, but ESM is pretty much the standard for js libraries nowadays.

@ashryanbeats
Copy link

Agreed @ianzone. Ram and I chatted with @mrashed-dev on our SDK team and he has share that ESM support is going into active development in a sprint soon. We'll keep you posted.

@mrashed-dev mrashed-dev linked a pull request Aug 15, 2023 that will close this issue
@mrashed-dev
Copy link
Contributor

Thanks @ianzone for submitting this issue, the feature is complete and will be included in the next major release of the SDK. We will have the first beta coming out very soon!

@mrashed-dev
Copy link
Contributor

Closing this issue as it's been included in the v7 beta releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants