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
For property types, you will get this error (as an example with RichTextDatabasePropertyConfigResponse): Property 'description' is missing in type '{ id: string; name: string; type: "rich_text"; rich_text: {}; }' but required in type 'RichTextDatabasePropertyConfigResponse'
Expected behavior satisfies GetDatabaseResponse on the data should work as client.databases.retrieve returns a Promise<GetDatabaseResponse>.
Additional context
It seems that description has been added in v2.2.15. See commit 4a21f8a which is part of the release.
Potential fixes
Today, description is defined like this:
description: PropertyDescriptionRequest|null
Thus, the API could always return the description field and set it to null if there is no description.
Or, the type could be fixed as such:
But then maybe we could also remove null and get rid of the union?
The text was updated successfully, but these errors were encountered:
borisghidaglia
changed the title
Types from DatabasePropertyConfigResponse union require a description and
Types from DatabasePropertyConfigResponse union require a descriptionApr 30, 2024
Describe the bug
Types from
DatabasePropertyConfigResponse
union require adescription
property.Example here.
However, the
description
property is not (always?) returned in the response if no description is provided on a notion db.To Reproduce
Node version: v21.7.3
Notion JS library version: 2.2.15
Steps to reproduce the behavior:
await client.databases.retrieve({ database_id: id })
and save this data as a TS const somewhere.satisfies
operator like this:For property types, you will get this error (as an example with
RichTextDatabasePropertyConfigResponse
):Property 'description' is missing in type '{ id: string; name: string; type: "rich_text"; rich_text: {}; }' but required in type 'RichTextDatabasePropertyConfigResponse'
Expected behavior
satisfies GetDatabaseResponse
on the data should work asclient.databases.retrieve
returns aPromise<GetDatabaseResponse>
.Additional context
It seems that
description
has been added inv2.2.15
. See commit 4a21f8a which is part of the release.Potential fixes
Today,
description
is defined like this:Thus, the API could always return the
description
field and set it tonull
if there is no description.Or, the type could be fixed as such:
But then maybe we could also remove
null
and get rid of the union?The text was updated successfully, but these errors were encountered: