Skip to content
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

Fix #5285 - Improve string type hints DX #5286

Merged
merged 1 commit into from Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/lib/autocomplete/AutoComplete.d.ts
Expand Up @@ -11,7 +11,7 @@ import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue
import { ComponentHooks } from '../basecomponent';
import { ButtonPassThroughOptions } from '../button';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';
import { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller';

export declare type AutoCompletePassThroughOptionType = AutoCompletePassThroughAttributes | ((options: AutoCompletePassThroughMethodOptions) => AutoCompletePassThroughAttributes | string) | string | null | undefined;
Expand Down Expand Up @@ -384,7 +384,7 @@ export interface AutoCompleteProps {
* Special keywords are 'body' for document body and 'self' for the element itself.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* When present, autocomplete clears the manual input if it does not match of the suggestions to force only accepting values from the suggestions.
* @defaultValue false
Expand Down
4 changes: 2 additions & 2 deletions components/lib/badge/Badge.d.ts
Expand Up @@ -10,7 +10,7 @@
import { VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type BadgePassThroughOptionType<T = any> = BadgePassThroughAttributes | ((options: BadgePassThroughMethodOptions<T>) => BadgePassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -70,7 +70,7 @@ export interface BadgeProps {
/**
* Severity type of the badge.
*/
severity?: 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'contrast' | string | null | undefined;
severity?: HintedString<'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'contrast'> | null | undefined;
/**
* Size of the badge, valid options are 'large' and 'xlarge'.
*/
Expand Down
6 changes: 3 additions & 3 deletions components/lib/button/Button.d.ts
Expand Up @@ -10,7 +10,7 @@
import { ButtonHTMLAttributes, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type ButtonPassThroughOptionType<T = any> = ButtonPassThroughAttributes | ((options: ButtonPassThroughMethodOptions<T>) => ButtonPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -119,7 +119,7 @@ export interface ButtonProps extends ButtonHTMLAttributes {
/**
* Severity type of the badge.
*/
badgeSeverity?: 'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'contrast' | string | null | undefined;
badgeSeverity?: HintedString<'secondary' | 'info' | 'success' | 'warning' | 'danger' | 'contrast'> | null | undefined;
/**
* Whether the button is in loading state.
* @defaultValue false
Expand All @@ -137,7 +137,7 @@ export interface ButtonProps extends ButtonHTMLAttributes {
/**
* Defines the style of the button.
*/
severity?: 'secondary' | 'success' | 'info' | 'warning' | 'help' | 'danger' | 'contrast' | string | undefined;
severity?: HintedString<'secondary' | 'success' | 'info' | 'warning' | 'help' | 'danger' | 'contrast'> | undefined;
/**
* Add a shadow to indicate elevation.
* @defaultValue false
Expand Down
4 changes: 2 additions & 2 deletions components/lib/calendar/Calendar.d.ts
Expand Up @@ -11,7 +11,7 @@ import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue
import { ComponentHooks } from '../basecomponent';
import { ButtonPassThroughOptions } from '../button';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type CalendarPassThroughOptionType = CalendarPassThroughAttributes | ((options: CalendarPassThroughMethodOptions) => CalendarPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -739,7 +739,7 @@ export interface CalendarProps {
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Identifier of the element.
*/
Expand Down
4 changes: 2 additions & 2 deletions components/lib/cascadeselect/CascadeSelect.d.ts
Expand Up @@ -10,7 +10,7 @@
import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type CascadeSelectPassThroughOptionType = CascadeSelectPassThroughAttributes | ((options: CascadeSelectPassThroughMethodOptions) => CascadeSelectPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -322,7 +322,7 @@ export interface CascadeSelectProps {
* A valid query selector or an HTMLElement to specify where the overlay gets attached. Special keywords are 'body' for document body and 'self' for the element itself.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Whether the dropdown is in loading state.
* @defaultValue false
Expand Down
4 changes: 2 additions & 2 deletions components/lib/colorpicker/ColorPicker.d.ts
Expand Up @@ -10,7 +10,7 @@
import { TransitionProps } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type ColorPickerPassThroughOptionType = ColorPickerPassThroughAttributes | ((options: ColorPickerPassThroughMethodOptions) => ColorPickerPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -181,7 +181,7 @@ export interface ColorPickerProps {
* A valid query selector or an HTMLElement to specify where the overlay gets attached. Special keywords are 'body' for document body and 'self' for the element itself.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Used to pass attributes to DOM elements inside the component.
* @type {ColorPickerPassThroughOptions}
Expand Down
4 changes: 2 additions & 2 deletions components/lib/contextmenu/ContextMenu.d.ts
Expand Up @@ -12,7 +12,7 @@ import { TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { MenuItem } from '../menuitem';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type ContextMenuPassThroughOptionType = ContextMenuPassThroughAttributes | ((options: ContextMenuPassThroughMethodOptions) => ContextMenuPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -231,7 +231,7 @@ export interface ContextMenuProps {
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Whether to automatically manage layering.
* @defaultValue true
Expand Down
8 changes: 4 additions & 4 deletions components/lib/datatable/DataTable.d.ts
Expand Up @@ -14,7 +14,7 @@ import { ColumnGroupPassThroughOptionType } from '../columngroup';
import { PaginatorPassThroughOptionType } from '../paginator';
import { PassThroughOptions } from '../passthrough';
import { RowPassThroughOptionType } from '../row';
import { ClassComponent, GlobalComponentConstructor, Nullable, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, Nullable, PassThrough, HintedString } from '../ts-helpers';
import { VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller';

export declare type DataTablePassThroughOptionType = DataTablePassThroughAttributes | ((options: DataTablePassThroughMethodOptions) => DataTablePassThroughAttributes | string) | string | null | undefined;
Expand Down Expand Up @@ -94,7 +94,7 @@ export interface DataTableFilterMetaData {
/**
* Filter match mode
*/
matchMode: 'startsWith' | 'contains' | 'notContains' | 'endsWith' | 'equals' | 'notEquals' | 'in' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'dateIs' | 'dateIsNot' | 'dateBefore' | 'dateAfter' | string | undefined;
matchMode: HintedString<'startsWith' | 'contains' | 'notContains' | 'endsWith' | 'equals' | 'notEquals' | 'in' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'dateIs' | 'dateIsNot' | 'dateBefore' | 'dateAfter'> | undefined;
}

/**
Expand Down Expand Up @@ -196,7 +196,7 @@ export interface DataTableSortEvent {
/**
* Match modes per field
*/
filterMatchModes: 'startsWith' | 'contains' | 'notContains' | 'endsWith' | 'equals' | 'notEquals' | 'in' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'dateIs' | 'dateIsNot' | 'dateBefore' | 'dateAfter' | string | undefined;
filterMatchModes: HintedString<'startsWith' | 'contains' | 'notContains' | 'endsWith' | 'equals' | 'notEquals' | 'in' | 'lt' | 'lte' | 'gt' | 'gte' | 'between' | 'dateIs' | 'dateIsNot' | 'dateBefore' | 'dateAfter'> | undefined;
}

/**
Expand Down Expand Up @@ -1080,7 +1080,7 @@ export interface DataTableProps {
/**
* Height of the scroll viewport in fixed pixels or the 'flex' keyword for a dynamic size.
*/
scrollHeight?: 'flex' | string | undefined;
scrollHeight?: HintedString<'flex'> | undefined;
/**
* Whether to use the virtualScroller feature. The properties of VirtualScroller component can be used like an object in it.
* Note: Currently only vertical orientation mode is supported.
Expand Down
4 changes: 2 additions & 2 deletions components/lib/dialog/Dialog.d.ts
Expand Up @@ -10,7 +10,7 @@
import { HTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type DialogPassThroughOptionType<T = any> = DialogPassThroughAttributes | ((options: DialogPassThroughMethodOptions<T>) => DialogPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -259,7 +259,7 @@ export interface DialogProps {
* A valid query selector or an HTMLElement to specify where the dialog gets attached.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Style of the dynamic dialog.
*/
Expand Down
6 changes: 3 additions & 3 deletions components/lib/dropdown/Dropdown.d.ts
Expand Up @@ -10,7 +10,7 @@
import { HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';
import { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller';

export declare type DropdownPassThroughOptionType<T = any> = DropdownPassThroughAttributes | ((options: DropdownPassThroughMethodOptions<T>) => DropdownPassThroughAttributes | string) | string | null | undefined;
Expand Down Expand Up @@ -305,7 +305,7 @@ export interface DropdownProps {
* Defines the filtering algorithm to use when searching the options.
* @defaultValue contains
*/
filterMatchMode?: 'contains' | 'startsWith' | 'endsWith' | string | undefined;
filterMatchMode?: HintedString<'contains' | 'startsWith' | 'endsWith'> | undefined;
/**
* Fields used when filtering the options, defaults to optionLabel.
*/
Expand Down Expand Up @@ -384,7 +384,7 @@ export interface DropdownProps {
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Whether the dropdown is in loading state.
* @defaultValue false
Expand Down
4 changes: 2 additions & 2 deletions components/lib/inlinemessage/InlineMessage.d.ts
Expand Up @@ -10,7 +10,7 @@
import { VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type InlineMessagePassThroughOptionType = InlineMessagePassThroughAttributes | ((options: InlineMessagePassThroughMethodOptions) => InlineMessagePassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -94,7 +94,7 @@ export interface InlineMessageProps {
* Severity level of the message.
* @defaultValue info
*/
severity?: 'success' | 'info' | 'warn' | 'error' | 'secondary' | 'contrast' | string | undefined;
severity?: HintedString<'success' | 'info' | 'warn' | 'error' | 'secondary' | 'contrast'> | undefined;
/**
* Display a custom icon for the message.
* @deprecated since v3.27.0. Use 'icon' slot.
Expand Down
4 changes: 2 additions & 2 deletions components/lib/listbox/Listbox.d.ts
Expand Up @@ -10,7 +10,7 @@
import { InputHTMLAttributes, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';
import { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller';

export declare type ListboxPassThroughOptionType = ListboxPassThroughAttributes | ((options: ListboxPassThroughMethodOptions) => ListboxPassThroughAttributes | string) | string | null | undefined;
Expand Down Expand Up @@ -282,7 +282,7 @@ export interface ListboxProps {
* Defines the filtering algorithm to use when searching the options.
* @defaultValue contains
*/
filterMatchMode?: 'contains' | 'startsWith' | 'endsWith' | string | undefined;
filterMatchMode?: HintedString<'contains' | 'startsWith' | 'endsWith'> | undefined;
/**
* Fields used when filtering the options, defaults to optionLabel.
*/
Expand Down
4 changes: 2 additions & 2 deletions components/lib/menu/Menu.d.ts
Expand Up @@ -11,7 +11,7 @@ import { TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { MenuItem } from '../menuitem';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type MenuPassThroughOptionType = MenuPassThroughAttributes | ((options: MenuPassThroughMethodOptions) => MenuPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -205,7 +205,7 @@ export interface MenuProps {
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Whether to automatically manage layering.
* @defaultValue true
Expand Down
4 changes: 2 additions & 2 deletions components/lib/message/Message.d.ts
Expand Up @@ -10,7 +10,7 @@
import { ButtonHTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type MessagePassThroughOptionType<T = any> = MessagePassThroughAttributes | ((options: MessagePassThroughMethodOptions<T>) => MessagePassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -118,7 +118,7 @@ export interface MessageProps {
* Severity level of the message.
* @defaultValue info
*/
severity?: 'success' | 'info' | 'warn' | 'error' | 'secondary' | 'contrast' | string | undefined;
severity?: HintedString<'success' | 'info' | 'warn' | 'error' | 'secondary' | 'contrast'> | undefined;
/**
* Whether the message can be closed manually using the close icon.
* @defaultValue true
Expand Down
6 changes: 3 additions & 3 deletions components/lib/multiselect/MultiSelect.d.ts
Expand Up @@ -10,7 +10,7 @@
import { ButtonHTMLAttributes, HTMLAttributes, InputHTMLAttributes, TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';
import { VirtualScrollerItemOptions, VirtualScrollerPassThroughOptionType, VirtualScrollerProps } from '../virtualscroller';

export declare type MultiSelectPassThroughOptionType = MultiSelectPassThroughAttributes | ((options: MultiSelectPassThroughMethodOptions) => MultiSelectPassThroughAttributes | string) | string | null | undefined;
Expand Down Expand Up @@ -395,7 +395,7 @@ export interface MultiSelectProps {
* Defines the filtering algorithm to use when searching the options.
* @defaultValue contains
*/
filterMatchMode?: 'contains' | 'startsWith' | 'endsWith' | string | undefined;
filterMatchMode?: HintedString<'contains' | 'startsWith' | 'endsWith'> | undefined;
/**
* Fields used when filtering the options, defaults to optionLabel.
*/
Expand All @@ -404,7 +404,7 @@ export interface MultiSelectProps {
* A valid query selector or an HTMLElement to specify where the overlay gets attached. Special keywords are 'body' for document body and 'self' for the element itself.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Defines how the selected items are displayed.
* @defaultValue comma
Expand Down
4 changes: 2 additions & 2 deletions components/lib/overlaypanel/OverlayPanel.d.ts
Expand Up @@ -10,7 +10,7 @@
import { TransitionProps, VNode } from 'vue';
import { ComponentHooks } from '../basecomponent';
import { PassThroughOptions } from '../passthrough';
import { ClassComponent, GlobalComponentConstructor, PassThrough } from '../ts-helpers';
import { ClassComponent, GlobalComponentConstructor, PassThrough, HintedString } from '../ts-helpers';

export declare type OverlayPanelPassThroughOptionType = OverlayPanelPassThroughAttributes | ((options: OverlayPanelPassThroughMethodOptions) => OverlayPanelPassThroughAttributes | string) | string | null | undefined;

Expand Down Expand Up @@ -136,7 +136,7 @@ export interface OverlayPanelProps {
* A valid query selector or an HTMLElement to specify where the overlay gets attached.
* @defaultValue body
*/
appendTo?: 'body' | 'self' | string | undefined | HTMLElement;
appendTo?: HintedString<'body' | 'self'> | undefined | HTMLElement;
/**
* Base zIndex value to use in layering.
* @defaultValue 0
Expand Down