Skip to content

[infra] Update typescript-api-extractor #2104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference/generated/alert-dialog-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"description": "Whether the dialog is currently open."
},
"onOpenChange": {
"type": "(open: boolean, event?: Event, reason?: AlertDialog.Root.OpenChangeReason) => void",
"type": "((open: boolean, event: Event | undefined, reason: DialogOpenChangeReason | undefined) => void)",
"description": "Event handler called when the dialog is opened or closed."
},
"actionsRef": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/context-menu-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"description": "Whether the menu is currently open."
},
"onOpenChange": {
"type": "(open: boolean, event?: Event, reason?: Menu.Root.OpenChangeReason) => void",
"type": "((open: boolean, event: Event | undefined, reason: Menu.Root.OpenChangeReason | undefined) => void)",
"description": "Event handler called when the menu is opened or closed."
},
"actionsRef": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/dialog-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"description": "Whether the dialog is currently open."
},
"onOpenChange": {
"type": "(open: boolean, event?: Event, reason?: Dialog.Root.OpenChangeReason) => void",
"type": "((open: boolean, event: Event | undefined, reason: DialogOpenChangeReason | undefined) => void)",
"description": "Event handler called when the dialog is opened or closed."
},
"actionsRef": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/menu-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"description": "Whether the menu is currently open."
},
"onOpenChange": {
"type": "(open: boolean, event?: Event, reason?: Menu.Root.OpenChangeReason) => void",
"type": "((open: boolean, event: Event | undefined, reason: Menu.Root.OpenChangeReason | undefined) => void)",
"description": "Event handler called when the menu is opened or closed."
},
"actionsRef": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/popover-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"description": "Whether the popover is currently open."
},
"onOpenChange": {
"type": "(open: boolean, event?: Event, reason?: Popover.Root.OpenChangeReason) => void",
"type": "((open: boolean, event: Event | undefined, reason: PopoverOpenChangeReason | undefined) => void)",
"description": "Event handler called when the popover is opened or closed."
},
"actionsRef": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/preview-card-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"description": "Whether the preview card is currently open."
},
"onOpenChange": {
"type": "(open: boolean, event?: Event, reason?: PreviewCard.Root.OpenChangeReason) => void",
"type": "((open: boolean, event: Event | undefined, reason: BaseOpenChangeReason | undefined) => void)",
"description": "Event handler called when the preview card is opened or closed."
},
"actionsRef": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/select-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"description": "Whether the select menu is currently open."
},
"onOpenChange": {
"type": "(open: boolean, event?: Event, reason?: Select.Root.OpenChangeReason) => void",
"type": "((open: boolean, event: Event | undefined, reason: SelectOpenChangeReason | undefined) => void)",
"description": "Event handler called when the select menu is opened or closed."
},
"actionsRef": {
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/generated/slider-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"description": "The value of the slider.\nFor ranged sliders, provide an array with two values."
},
"onValueChange": {
"type": "((value: (number | number[]), event: Event, activeThumbIndex: number) => void)",
"type": "((value: number | number | readonly number[], event: Event, activeThumbIndex: number) => void)",
"description": "Callback function that is fired when the slider's value changed."
},
"onValueCommitted": {
"type": "((value: (number | number[]), event: Event) => void)",
"type": "((value: number | number | readonly number[], event: Event) => void)",
"description": "Callback function that is fired when the `pointerup` is triggered."
},
"locale": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/slider-thumb.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"description": "CSS class applied to the element, or a function that\nreturns a class based on the component’s state."
},
"render": {
"type": "((props: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, inputProps: DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, state: Slider.Thumb.State) => ReactElement) | ReactElement & { ref: Ref<Element> }",
"type": "((props: ComponentPropsWithRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, inputProps: ComponentPropsWithRef<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, state: Slider.Thumb.State) => ReactElement) | ReactElement & { ref: Ref<Element> }",
"description": "Allows you to replace the component’s HTML element\nwith a different tag, or compose it with another component.\n\nAccepts a `ReactElement` or a function that returns the element to render."
}
},
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/tabs-panel.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A panel displayed when the corresponding tab is active.\nRenders a `<div>` element.",
"props": {
"value": {
"type": "Tabs.Tab.Value",
"type": "any",
"description": "The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected.\nIf not provided, it will fall back to the index of the panel.\nIt is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server."
},
"className": {
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/generated/tabs-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
"description": "Groups the tabs and the corresponding panels.\nRenders a `<div>` element.",
"props": {
"defaultValue": {
"type": "Tabs.Tab.Value",
"type": "any",
"default": "0",
"description": "The default value. Use when the component is not controlled.\nWhen the value is `null`, no Tab will be selected."
},
"value": {
"type": "Tabs.Tab.Value",
"type": "any",
"description": "The value of the currently selected `Tab`. Use when the component is controlled.\nWhen the value is `null`, no Tab will be selected."
},
"onValueChange": {
"type": "((value: any, event: Event | undefined) => void)",
"description": "Callback invoked when new value is being set."
},
"orientation": {
"type": "Tabs.Root.Orientation",
"type": "Orientation",
"default": "'horizontal'",
"description": "The component orientation (layout flow direction)."
},
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/tabs-tab.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "An individual interactive tab button that toggles the corresponding panel.\nRenders a `<button>` element.",
"props": {
"value": {
"type": "Tabs.Tab.Value",
"type": "any",
"description": "The value of the Tab.\nWhen not specified, the value is the child position index."
},
"nativeButton": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/toast-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"description": "Direction(s) in which the toast can be swiped to dismiss."
},
"toast": {
"type": "Toast.Root.ToastObject",
"type": "Toast.Root.ToastObject<any>",
"required": true,
"description": "The toast to render."
},
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/toolbar-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"description": "If `true`, using keyboard navigation will wrap focus to the other end of the toolbar once the end is reached."
},
"orientation": {
"type": "Toolbar.Root.Orientation",
"type": "Orientation",
"default": "'horizontal'",
"description": "The orientation of the toolbar."
},
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/tooltip-root.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"description": "Whether the tooltip is currently open."
},
"onOpenChange": {
"type": "(open: boolean, event?: Event, reason?: Tooltip.Root.OpenChangeReason) => void",
"type": "((open: boolean, event: Event | undefined, reason: TooltipOpenChangeReason | undefined) => void)",
"description": "Event handler called when the tooltip is opened or closed."
},
"actionsRef": {
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/generated/use-render.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Renders a Base UI element.",
"parameters": {
"render": {
"type": "useRender.RenderProp",
"type": "useRender.RenderProp<State>",
"required": true,
"description": "The React element or a function that returns one to override the default element."
},
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/alert-dialog/root/AlertDialogRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export namespace AlertDialogRoot {
export interface Props extends Omit<DialogRoot.Props, 'modal' | 'dismissible' | 'onOpenChange'> {
/**
* Event handler called when the dialog is opened or closed.
* @type (open: boolean, event?: Event, reason?: AlertDialog.Root.OpenChangeReason) => void
*/
onOpenChange?: (
open: boolean,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/dialog/root/useDialogRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ export namespace useDialogRoot {
modal?: boolean | 'trap-focus';
/**
* Event handler called when the dialog is opened or closed.
* @type (open: boolean, event?: Event, reason?: Dialog.Root.OpenChangeReason) => void
*/
onOpenChange?: (
open: boolean,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/menu/root/MenuRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,6 @@ export namespace MenuRoot {
modal?: boolean;
/**
* Event handler called when the menu is opened or closed.
* @type (open: boolean, event?: Event, reason?: Menu.Root.OpenChangeReason) => void
*/
onOpenChange?: (
open: boolean,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/popover/root/PopoverRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ export namespace PopoverRoot {
open?: boolean;
/**
* Event handler called when the popover is opened or closed.
* @type (open: boolean, event?: Event, reason?: Popover.Root.OpenChangeReason) => void
*/
onOpenChange?: (
open: boolean,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/preview-card/root/PreviewCardRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export namespace PreviewCardRoot {
open?: boolean;
/**
* Event handler called when the preview card is opened or closed.
* @type (open: boolean, event?: Event, reason?: PreviewCard.Root.OpenChangeReason) => void
*/
onOpenChange?: (
open: boolean,
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/select/root/useSelectRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ export namespace useSelectRoot {
defaultOpen?: boolean;
/**
* Event handler called when the select menu is opened or closed.
* @type (open: boolean, event?: Event, reason?: Select.Root.OpenChangeReason) => void
*/
onOpenChange?: (
open: boolean,
Expand Down
4 changes: 0 additions & 4 deletions packages/react/src/slider/root/SliderRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,6 @@ export namespace SliderRoot {
* @param {Event} event The corresponding event that initiated the change.
* You can pull out the new value by accessing `event.target.value` (any).
* @param {number} activeThumbIndex Index of the currently moved thumb.
*
* @type {((value: (number | number[]), event: Event, activeThumbIndex: number) => void)}
*/
onValueChange?: (
value: Value extends number ? number : Value,
Expand All @@ -504,8 +502,6 @@ export namespace SliderRoot {
* @param {number | number[]} value The new value.
* @param {Event} event The corresponding event that initiated the change.
* **Warning**: This is a generic event not a change event.
*
* @type {((value: (number | number[]), event: Event) => void)}
*/
onValueCommitted?: (value: Value extends number ? number : Value, event: Event) => void;
}
Expand Down
2 changes: 0 additions & 2 deletions packages/react/src/slider/thumb/SliderThumb.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ export namespace SliderThumb {
* Accepts a function which returns a string value that provides a user-friendly name for the input associated with the thumb
* @param {number} index The index of the input
* @returns {string}
* @type {((index: number) => string) | null}
*/
getAriaLabel?: ((index: number) => string) | null;
/**
Expand All @@ -405,7 +404,6 @@ export namespace SliderThumb {
* @param {number} value The thumb's numerical value.
* @param {number} index The thumb's index.
* @returns {string}
* @type {((formattedValue: string, value: number, index: number) => string) | null}
*/
getAriaValueText?: ((formattedValue: string, value: number, index: number) => string) | null;
/**
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/tabs/panel/TabsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ export namespace TabsPanel {
* The value of the TabPanel. It will be shown when the Tab with the corresponding value is selected.
* If not provided, it will fall back to the index of the panel.
* It is recommended to explicitly provide it, as it's required for the tab panel to be rendered on the server.
* @type Tabs.Tab.Value
*/
value?: TabsTab.Value;
/**
Expand Down
9 changes: 0 additions & 9 deletions packages/react/src/tabs/root/TabsRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,33 +193,24 @@ export namespace TabsRoot {
export type Orientation = BaseOrientation;

export type State = {
/**
* @type Tabs.Root.Orientation
*/
orientation: Orientation;
/**
* @type Tabs.Tab.ActivationDirection
*/
tabActivationDirection: TabsTab.ActivationDirection;
};

export interface Props extends BaseUIComponentProps<'div', State> {
/**
* The value of the currently selected `Tab`. Use when the component is controlled.
* When the value is `null`, no Tab will be selected.
* @type Tabs.Tab.Value
*/
value?: TabsTab.Value;
/**
* The default value. Use when the component is not controlled.
* When the value is `null`, no Tab will be selected.
* @type Tabs.Tab.Value
* @default 0
*/
defaultValue?: TabsTab.Value;
/**
* The component orientation (layout flow direction).
* @type Tabs.Root.Orientation
* @default 'horizontal'
*/
orientation?: Orientation;
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/tabs/tab/TabsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ export namespace TabsTab {
/**
* The value of the Tab.
* When not specified, the value is the child position index.
* @type Tabs.Tab.Value
*/
value?: Value;
/**
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/toolbar/root/ToolbarRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export namespace ToolbarRoot {
disabled?: boolean;
/**
* The orientation of the toolbar.
* @type Toolbar.Root.Orientation
* @default 'horizontal'
*/
orientation?: Orientation;
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/tooltip/root/useTooltipRoot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ export namespace useTooltipRoot {
open?: boolean;
/**
* Event handler called when the tooltip is opened or closed.
* @type (open: boolean, event?: Event, reason?: Tooltip.Root.OpenChangeReason) => void
*/
onOpenChange?: (
open: boolean,
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion scripts/api-docs-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"lodash": "^4.17.21",
"rimraf": "^6.0.1",
"tsx": "^4.19.4",
"typescript-api-extractor": "1.0.0-alpha.2",
"typescript-api-extractor": "1.0.0-alpha.3",
"yargs": "^17.7.2"
},
"scripts": {
Expand Down
8 changes: 6 additions & 2 deletions scripts/api-docs-builder/src/formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export function formatType(
return typeValue;
}

if (type.name === 'HTMLProps<any>') {
return 'HTMLProps';
}

if (type instanceof tae.ReferenceNode) {
if (/^ReactElement(<.*>)?/.test(type.name)) {
return 'ReactElement';
Expand All @@ -72,7 +76,7 @@ export function formatType(

if (type instanceof tae.UnionNode) {
if (type.name) {
return getFullyQualifiedName(type.name, type.parentNamespaces);
return getFullyQualifiedName(type.name, type.parentNamespaces ?? []);
}

const memberTypes = type.types;
Expand All @@ -94,7 +98,7 @@ export function formatType(

if (type instanceof tae.IntersectionNode) {
if (type.name) {
return getFullyQualifiedName(type.name, type.parentNamespaces);
return getFullyQualifiedName(type.name, type.parentNamespaces ?? []);
}

return orderMembers(type.types)
Expand Down