Skip to content

chore(types): remove nullability from some children props in unstable/experimental components#3918

Merged
kligarski merged 2 commits intomainfrom
@kligarski/unify-children-prop
Apr 21, 2026
Merged

chore(types): remove nullability from some children props in unstable/experimental components#3918
kligarski merged 2 commits intomainfrom
@kligarski/unify-children-prop

Conversation

@kligarski
Copy link
Copy Markdown
Contributor

@kligarski kligarski commented Apr 21, 2026

Description

This PR is a follow-up to #3719. We adjust children property to be not nullable for Host components (Tabs, Split and Stack v5) and subviews in Stack v5 implementation.

This change is applied only to unstable/experimental components so it shouldn't be considered a breaking change.

Changes

  • wrap ReactNode/ViewProps['children'] in NonNullable for:
    • StackHost
    • TabsHost
    • SplitHost
    • StackHeaderSubview and related places in StackHeaderConfig

Before & after - visual documentation

N/A

Test plan

yarn check-types

Checklist

  • For API changes, updated relevant public types.
  • Ensured that CI passes

Copy link
Copy Markdown
Contributor Author

@kligarski kligarski left a comment

Choose a reason for hiding this comment

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

I decided not to mess with overriding children prop in Fabric specs but it's not a public API so it shouldn't be a problem.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens TypeScript typings for experimental/unstable Host components by making their children (and related header subview component fields) non-nullable, aligning with the repo’s exactOptionalPropertyTypes work and ensuring these hosts always receive renderable content.

Changes:

  • Make children required and NonNullable<...> for TabsHost, StackHost (gamma), and SplitHost (gamma).
  • Make Stack v5 Android header subview children required and non-nullable.
  • Make Stack v5 Android header config subview Component fields non-nullable.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/components/tabs/host/TabsHost.types.ts Makes TabsHost children required and non-nullable.
src/components/gamma/stack/host/StackHost.types.ts Makes StackHost children non-nullable.
src/components/gamma/stack/header/android/StackHeaderSubview.android.types.ts Makes header subview children required and non-nullable.
src/components/gamma/stack/header/StackHeaderConfig.android.types.ts Makes toolbar/background subview Component non-nullable.
src/components/gamma/split/SplitHost.types.ts Makes SplitHost children required and non-nullable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kligarski kligarski merged commit 12edf29 into main Apr 21, 2026
5 checks passed
@kligarski kligarski deleted the @kligarski/unify-children-prop branch April 21, 2026 15:23
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.

3 participants