cstrnt / notion-api

Unofficial Notion.so API

Home Page:https://www.npmjs.com/package/notion-api-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError prevents object creation.

SirTangent opened this issue · comments

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

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 😄

Hi Tim,

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