-
Notifications
You must be signed in to change notification settings - Fork 691
Description
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
While using the SDK in a heavily TypeScript-driven fashion, I've encountered serious issues with the compiler:
error TS7056: The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed.
The reason, I believe, is that notion types for responses contain giant unions of strings for timezones, which are not properly exported from the sdk package bundle. So, what this leads to is, instead of simply referring to the types where they are used, the TypeScript declarations generator for my code inlines those giant unions into the .d.ts files, quickly leading to overflows.
Solution: just export the types guys! There is no hiding them anyway - I can still extract any type I need by doing property lookups. But you actually start building something heavily type-safe you quickly hit the compiler limit.
To Reproduce
Node version: 22
Notion JS library version: 2.3.0 (latest)
TypeScript: latest
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
Please include any screenshots that help explain your problem.
What we do:
What TypeScript generates:
What's the issue on your end (in the bundled declaration that you ship in the package):
If there was a properly exported type for this properly value TypeScript would use a compact declaration for it.
The culprit (this inlining repeats hundreds of times):
Additional context
Add any other context about the problem here.