Repository navigation
fix: allow column_list/column as children of single-level-nestable blocks - #779
Open
ShayanMuhammad-CS wants to merge 2 commits into
Open
ShayanMuhammad-CS wants to merge 2 commits into
ShayanMuhammad-CS wants to merge 2 commits into
Conversation
Author
|
recheck |
…ocks Blocks like `callout`, `toggle`, `quote`, `bulleted_list_item`, etc. support one level of nested `children` via `BlockObjectWithSingleLevelOfChildrenRequest`, but that union was missing `column_list`/`column` entirely, even though the top-level `BlockObjectRequest` union supported them. As a result, TypeScript rejected a real, API-supported shape: a column layout nested inside a callout (reproduced from a real API response in the issue thread). Adds `column_list`/`column` variants to the single-level union, using depth-reduced child types so columns at this depth still cannot themselves contain a further nested `children` level (consistent with how every other nestable block in that union is modeled). Fixes makenotion#575
ShayanMuhammad-CS
force-pushed
the
fix/callout-nested-column-list-575
branch
from
August 25, 2026 19:51
fe60aeb to
a4c401a
Compare
Author
|
recheck |
1 similar comment
Author
|
recheck |
Author
|
Hi @ksinder — following up since you were involved in the discussion on #575 and the earlier attempt (#613). This PR fixes the underlying bug from that thread: `column_list`/`column` were missing from `BlockObjectWithSingleLevelOfChildrenRequest`, so a callout with a nested column layout (as shown in the API response @Fental posted in the issue) didn't type-check even though the API supports it. Build/lint/tests all pass locally, and I added a regression test (`test/block-nesting-types.test.ts`). Would appreciate a review/workflow approval when you have a chance. Thanks! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #575.
The original report claimed
calloutblocks were missing fromBlockObjectRequestentirely — that part was already fixed onmainand a prior attempt (#613) was rightly closed since it couldn't reproduce a compile error for that case.However, a real bug was left unresolved further down the same issue thread: @Fental's comment posted a real API response showing a
calloutblock containing a nestedcolumn_list→column→paragraph. That shape does not type-check onmaintoday:Root cause
BlockObjectWithSingleLevelOfChildrenRequest(src/api-endpoints/common.ts) models the children of blocks that support one level of nesting —callout,toggle,quote,bulleted_list_item,numbered_list_item,heading_1-4,paragraph,template,synced_block. That union is missingcolumn_list/columnentirely, even though the top-levelBlockObjectRequestunion supports them fine. So a column layout could be created at the root of a page, but not nested inside any of those container blocks — despite the Notion API allowing it.Fix
Added
column_list/columnvariants toBlockObjectWithSingleLevelOfChildrenRequest, mirroring the existing top-levelColumnListRequest/ColumnWithChildrenRequestdefinitions but with children capped one level deeper (BlockObjectRequestWithoutChildren), consistent with how every other nestable block type in that union reduces its child depth (e.g.quote,toggle).Test plan
npm run build(tsc) — no errorsnpm run lint— no new warnings/errors introduced by this changenpm test— 130/130 passingtest/block-nesting-types.test.ts, a type-level regression test (viats-jest) that:column_list/column/paragraphlayout now compilesquotenested inside acolumnstill correctly fails to compile)