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
Cannot access API types when using ESM #418
Comments
YES! no types for those of us who use ESM... :( |
any updates? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Report bugs here only for the Node JavaScript library.
If you're having problems using Notion's API, or have any other feedback about the API including feature requests for the JavaScript library, please email support at [email protected].
Describe the bug
When using ESM TypeScript cannot import API types because
api-endpoints
is not exported according to ESM semantics.To Reproduce
Node version: 18.16.0
Notion JS library version: 2.2.6
Steps to reproduce the behavior:
tsconfig.json
extending@tsconfig/node18
, along withnotion-sdk-js
(i.e.npm i notion-sdk-js typescript @tsconfig/node18
)index.mts
file@notionhq/client/build/src/api-endpoints
Expected behavior
The import to be error-free
Screenshots
Additional context
I'm pretty sure you could fix this by adding the following to the
package.json
:This works locally, but I'm not experienced with ESM enough to say for sure that that is exactly what this package should be configured with, or if there's something missing which my use of the library doesn't hit.
The alternative that I know will work would be to re-export all of the types from
index.d.ts
with an alias:That would allow
import { API } from '@notionhq/client'
which could then be used to access the types.I'm happy to do a PR for either of these options (or both)
The text was updated successfully, but these errors were encountered: