Skip to content

[types] PayloadChildRenderFunction isn't exported, so popup Root children types aren't portable #6203

Open

Description

@kevinwmerritt

Bug report

Current behavior

The children prop of the popup roots (Dialog.Root, Menu.Root, Popover.Root, Tooltip.Root, PreviewCard.Root, Drawer.Root) includes PayloadChildRenderFunction<Payload>. That type is declared in utils/popups/popupStoreUtils and isn't exported from any public entry point (./utils isn't in the package's exports map), so declaration emit can't name it:

import { Dialog } from '@base-ui/react/dialog';

export const children = (null as unknown as Dialog.Root.Props<string>)['children'];
error TS2883: The inferred type of 'children' cannot be named without a reference to
'PayloadChildRenderFunction' from './node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs'.
This is likely not portable. A type annotation is necessary.

We hit it while generating a standalone .d.ts that documents components wrapping these roots. Every other root prop resolves to a public type (for example handle is reachable as Dialog.Handle). children is the only one that points at an internal file.

Expected behavior

PayloadChildRenderFunction (or the children type as a whole) is exported publicly, so wrapper and documentation tooling can name it. That's the same treatment #2912 gave the other top-level types for #2881.

Reproducible example

tsconfig.json:

{
  "compilerOptions": {
    "declaration": true,
    "emitDeclarationOnly": true,
    "module": "ESNext",
    "moduleResolution": "bundler",
    "jsx": "react-jsx",
    "strict": true,
    "skipLibCheck": true
  },
  "files": ["index.ts"]
}

index.ts is the snippet above. Run tsc -p ..

Base UI version

1.9.0 (@base-ui/react)

Which browser are you using?

N/A (types only)

Which OS are you using?

N/A

Which assistive tech are you using (if applicable)?

N/A

Additional context

TypeScript 7.0.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions