question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Typing issue with 0.4.0

See original GitHub issue

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@notion.com.

Describe the bug A clear and concise description of what the bug is. Upon upgrading to 0.4.0, typings have gone crazy. api-types is now replaced by api-endpoints. The problem is the type for each Block is now gone. To Reproduce Node version: 14 Notion JS library version: 0.4.0

Steps to reproduce the behavior:

Expected behavior Typing for each Block type should be defined separately and exposed.

Screenshots Like trying to get HeadingOneBlock out of this type union is a nightmare image

image

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:13
  • Comments:9

github_iconTop GitHub Comments

3reactions
GorvGoylcommented, Oct 14, 2021

just learned that we can extract nested types from other types.

import {
  CreatePageParameters,
  QueryDatabaseResponse,
} from "@notionhq/client/build/src/api-endpoints";

export type PageProperties = Pick<CreatePageParameters, "properties">;

export type Page = QueryDatabaseResponse["results"][number];

Typescript is awesome!

3reactions
GorvGoylcommented, Oct 7, 2021

new 0.4 package defeats the whole purpose of Typescript if they aren’t allowing us to import the types. Earlier I could just import Page type from notionhq pkg but now it’s replaced with 200+ lines of inline definitions. How are we supposed to import this in our code? copy-paste?

image

And it’s not just Page but many other useful definitions are gone RichTextText, PagesUpdateParameters, PagesCreateParameters, InputPropertyValueMap, RichText, PropertyValueMap etc.

New inline typings may suit Notion team internally but it’s no use to people who are using this TS package in production.

reverted back to 0.3 for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Broken `Type Hints` in PyTorch 0.4.0 : PY-31259
Just tested this with torch version 1.0 (and the latest PyCharm version) and the problem persists. This is not good at all as...
Read more >
Fix list for IBM Personal Communications
This document contains a complete listing of releases, refreshes, fix packs and interim fixes sorted by version for IBM Personal ...
Read more >
Unity Barracuda | Barracuda | 0.4.0-preview
To load ONNX model, first add its .onnx file to your project. It will be imported and show up as an asset of...
Read more >
react-keyboard - npm Package Health Analysis
Ensure you're using the healthiest npm packages. Snyk scans all the packages in your projects for vulnerabilities and provides automated fix ...
Read more >
CVE-2022-23495 Detail - NVD
This issue has been addressed across a number of pull requests. Users are advised to upgrade to version 0.8.1 ... 0.4.0, Up to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found