You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 developers@makenotion.com.
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:
Use latest TypeScript with tsconfig.json extending @tsconfig/node18, along with notion-sdk-js (i.e. npm i notion-sdk-js typescript @tsconfig/node18)
Create a new index.mts file
Attempt to import a type from @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:
export * as API from './api-endpoints'
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:
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 developers@makenotion.com.
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: