Skip to content

chore: Split public and internal interface#440

Merged
pan-kot merged 2 commits into
mainfrom
public-interfaces-contract
Jul 20, 2026
Merged

chore: Split public and internal interface#440
pan-kot merged 2 commits into
mainfrom
public-interfaces-contract

Conversation

@pan-kot

@pan-kot pan-kot commented Jul 10, 2026

Copy link
Copy Markdown
Member

Description

Same changes as in components repo: cloudscape-design/components#4703

How has this been tested?

  • Dry-run to live (7927754436)
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.44%. Comparing base (d33abaf) to head (02ec49a).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #440      +/-   ##
==========================================
+ Coverage   91.24%   91.44%   +0.20%     
==========================================
  Files          59       59              
  Lines        1724     1730       +6     
  Branches      466      467       +1     
==========================================
+ Hits         1573     1582       +9     
+ Misses        151      148       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pan-kot
pan-kot marked this pull request as ready for review July 11, 2026 13:22
@pan-kot
pan-kot requested a review from a team as a code owner July 11, 2026 13:22
@pan-kot
pan-kot requested review from jperals and removed request for a team July 11, 2026 13:22
Comment thread src/board/interfaces.ts
import { Position } from "../internal/utils/position";
import { NonCancelableEventHandler } from "../types/events";

export type DataFallbackType = Record<string, unknown>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this type now duplicated? (in src/internal/interfaces.ts and here)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, but since the public type lives in the board component - it is not correct to import it from the code that is unrelated to the board. We can create some shared src/types/util.ts - to host the shared interfaces, but this sounds like an overkill in this case.

Comment thread src/board/interfaces.ts

export namespace BoardProps {
export type Item<D = DataFallbackType> = BoardItemDefinition<D>;
export interface Item<D = DataFallbackType> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one also introduces a bit of duplication. Would it help to have a "non-internal" common interfaces file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not quite the duplication, see:

// palette
export interface Item<D = DataFallbackType> {
    id: string;
    data: D;
    definition?: { minRowSpan?: number; minColumnSpan?: number; defaultRowSpan?: number; defaultColumnSpan?: number };
}

// board
export interface Item<D = DataFallbackType> {
    id: string;
    data: D;
    definition?: { minRowSpan?: number; minColumnSpan?: number; defaultRowSpan?: number; defaultColumnSpan?: number };
    columnOffset?: { [columns: number]: number };
    rowSpan?: number;
    columnSpan?: number;
}

We can have some shared types, but I am not sure how to better name it in this case. The Item type actually describes item configuration - relevant for palette and board, but not board-item. I can think of some shared item-definition type maybe, but I see no strong reason to do it now. These item definitions do not actually have to have a common base and can as well evolve independently from one another.

Comment thread src/internal/utils/events.ts Outdated

// our events are not cancelable even though `CustomEvent` may seem to allow this
export type NonCancelableEventHandler<Detail> = (event: CustomEvent<Detail>) => void;
export type { NonCancelableEventHandler } from "../../types/events";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this moved? Because this path has "internal" in the name but it is exported publicly? If that is the reason, do we need to keep this re-export? It doesn't seem to have consumers anymore (unless customers import it from here)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was an insurance - relevant for the component repo as we do have consumers who import the internal types, unfortunately. However, that is not relevant for the board-components repo - I will remove it.


export namespace ItemsPaletteProps {
export type Item<D = DataFallbackType> = BoardItemDefinitionBase<D>;
export interface Item<D = DataFallbackType> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about duplication

@pan-kot
pan-kot requested a review from jperals July 17, 2026 09:15
@pan-kot
pan-kot added this pull request to the merge queue Jul 20, 2026
Merged via the queue into main with commit 5102be4 Jul 20, 2026
45 of 46 checks passed
@pan-kot
pan-kot deleted the public-interfaces-contract branch July 20, 2026 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants