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

TypeError prevents object creation. #5

Closed
SirTangent opened this issue Sep 2, 2019 · 2 comments
Closed

TypeError prevents object creation. #5

SirTangent opened this issue Sep 2, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@SirTangent
Copy link

I used the following code to run the library (of course, I used an actual token):

const Notion = require("notion-api-js");

let api = new Notion({
    token: "<some token>"
});

I end up getting a TypeError upon running:

TypeError: Notion is not a constructor
@cstrnt cstrnt self-assigned this Sep 4, 2019
@cstrnt cstrnt added the bug Something isn't working label Sep 4, 2019
@cstrnt
Copy link
Owner

cstrnt commented Sep 4, 2019

Hi there,

thanks for clarifying! You need to import it like that using the require syntax:

const Notion = require("notion-api-js").default;

// following code

I will edit the readme so others won't have the same issue! Thank you 😄

@SirTangent
Copy link
Author

Hi Tim,

adding the .default at the end really helped. The wrapper works for me now. Thank you for clarifying this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants