Skip to content

JSDoc @default / type mismatch — Components Aria#34241

Open
dmlvr wants to merge 73 commits into
DevExpress:mainfrom
dmlvr:26_1_jsdoc_default_mismath_components_aria
Open

JSDoc @default / type mismatch — Components Aria#34241
dmlvr wants to merge 73 commits into
DevExpress:mainfrom
dmlvr:26_1_jsdoc_default_mismath_components_aria

Conversation

@dmlvr

@dmlvr dmlvr commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

dmlvr and others added 30 commits July 8, 2026 15:34
Widen onValueChanged, validationError, validationErrors and value to
include | null, matching the null stored in Editor._getDefaultOptions().
Widen _getValidationErrors() return type to unknown[] | null | undefined
since it directly returns the now-nullable validationErrors option.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Widen value to include | null, matching the null stored in
DataExpressionMixin._dataExpressionDefaultOptions().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d.ts

Widen buttons to | undefined (runtime stores void 0) and onChange,
onCopy, onCut, onEnterKey, onFocusIn, onFocusOut, onInput, onKeyDown,
onKeyUp, onPaste to | null (runtime stores null), matching
TextEditorBase._getDefaultOptions().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…et.base.d.ts

Widen keyExpr, onItemClick, onItemContextMenu, onItemHold,
onItemRendered, onSelectionChanging, onSelectionChanged and
selectedItem to include | null, matching the null stored in
CollectionWidget._getDefaultOptions() (collection_widget.base.ts /
collection_widget.edit.ts).

Widen List.scrollToItem() parameter type to accept | null: isDefined()
already treats null and undefined identically at runtime, so this only
corrects the signature to match the now-nullable selectedItem consumer
in select_box.ts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Widen searchExpr to include | null: the mixin has no own default, but
consumers (list.edit.search.ts, drop_down_list.ts) store null.

Follow-on fixes required to keep check-types clean:
- data_adapter.ts: widen DataAdapterOptions.searchExpr to | null since
  tree_view.search.ts passes the now-nullable option straight through;
  verified safe (data_adapter.ts consumes it via a nullish coalescing
  fallback and passes it as an opaque filter value).
- list.edit.search.ts: remove the ts-expect-error over searchExpr: null,
  now unused after widening.
- list.base.ts: add an explicit cast at the single affected call site
  in _getSpecificDataSourceOption() to work around a TS overload
  resolution fragility in component.d.ts option() (see Known Issues
  in progres_report.md for the full root-cause writeup).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…_editor.d.ts

Verified against js/__internal/ui/drop_down_editor/drop_down_editor.ts
_getDefaultOptions():
- buttons stores void 0 -> add | undefined
- onClosed, onOpened, value store null -> add | null

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…_list.d.ts

Verified against js/__internal/ui/drop_down_editor/drop_down_list.ts
_getDefaultOptions() (onValueChanged inherited from editor.ts):
- onSelectionChanged, onValueChanged, searchExpr, selectedItem store
  null -> add | null
- onItemClick stores noop (a function) at this level, not null; the
  type is already correct (a function), so corrected the inaccurate
  @default null tag instead of widening the type (doc-only change,
  no behavior impact)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verified against js/__internal/ui/select_box.ts _getDefaultOptions():
fieldTemplate stores null -> add | null.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verified against js/__internal/ui/color_box/color_box.ts
_getDefaultOptions(): fieldTemplate stores null -> add | null.

Removed the now-unused @ts-expect-error directly above
fieldTemplate: null in color_box.ts, made stale by the widened type.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fieldTemplate is inherited from
js/__internal/ui/drop_down_editor/drop_down_editor.ts
_getDefaultOptions(), which stores null -> add | null.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verified against js/__internal/ui/lookup.ts _getDefaultOptions()
(fieldTemplate inherited from drop_down_editor.ts, onValueChanged
inherited from editor.ts): fieldTemplate, onPageLoading, onPullRefresh,
onScroll, onValueChanged all store null -> add | null.

Removed the 3 now-unused @ts-expect-error directives above
onScroll/onPullRefresh/onPageLoading in lookup.ts, made stale by the
widened types.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verified against js/__internal/ui/tag_box.ts _getDefaultOptions()
(onSelectionChanged inherited from collection_widget.base.ts):
onMultiTagPreparing, onSelectAllValueChanged, onSelectionChanged all
store null -> add | null.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verified against js/__internal/ui/text_box/text_box.ts
_getDefaultOptions(): maxLength stores null -> add | null.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verified against js/__internal/ui/number_box/m_number_box.base.ts
_getDefaultOptions(): buttons stores void 0 -> add | undefined.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verified against js/__internal/ui/date_box/date_box.base.ts
_getDefaultOptions() (maxLength inherited from text_box.ts):
- disabledDates, maxLength, displayFormat store null -> add | null
- value?: DateLike is a known linter blind spot (DateLike already
  includes null; the linter does not resolve type aliases) -> left
  untouched, no edit needed

Follow-on fixes required to keep check-types clean:
- Removed 2 now-unused @ts-expect-error above displayFormat/
  disabledDates in date_box.base.ts, made stale by the widened types.
- Widened Strategy.getDisplayFormat's displayFormat param to accept
  | null across all 6 date_box strategy implementations (base,
  calendar, calendar_with_time, date_view, list, native); all bodies
  already treat null/undefined identically via `||` fallback, so this
  is a safe, behavior-preserving signature widening (same pattern as
  the earlier List.scrollToItem() fix).
- Fixed a separate, unrelated latent bug exposed by the above: added
  the missing `useHiddenSubmitElement?: boolean;` field to
  DateBoxBaseProperties (already present on the internal
  DropDownEditorProperties type it structurally extends), resolving an
  excess-property-check error on the _getDefaultOptions() object
  literal that TypeScript had not previously surfaced.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Verified against js/__internal/ui/calendar/calendar.ts
_getDefaultOptions(): disabledDates stores null -> add | null.

value?: DateLike | DateLike[] is a known linter blind spot (DateLike
already includes null; the linter does not resolve type aliases) ->
left untouched, no edit needed.

Follow-on fix: widened the same-named disabledDates field on
BaseViewProperties in calendar.base_view.ts (which also stores null
in its own _getDefaultOptions()) to keep the object literal built in
calendar.ts:_viewConfig() assignable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
value had a concrete @default false but the type included a spurious
| undefined (R2: a concrete @default must not include | undefined).
Verified against js/__internal/ui/check_box/check_box.tsx
(defaultCheckBoxProps.defaultValue: false, used whenever value is
untouched) that the real stored/resolved default is the concrete
false, never undefined -> removed | undefined, kept | null (used for
the indeterminate three-state case).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warnings for 12 event handler options
in js/ui/list.d.ts: onGroupRendered, onItemClick, onItemContextMenu,
onItemDeleted, onItemDeleting, onItemHold, onItemReordered, onItemSwipe,
onPageLoading, onPullRefresh, onScroll, onSelectAllValueChanged.

Verified runtime defaults are null in list.base.ts, list.edit.ts and
collection_widget.base.ts/collection_widget.edit.ts (already fixed
in a prior batch). Widened each type with `| null` and removed the
now-stale @ts-expect-error suppressions in list.base.ts and
list.edit.ts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warnings for 9 event handler options
in js/ui/tree_view.d.ts: onItemClick, onItemCollapsed, onItemContextMenu,
onItemExpanded, onItemHold, onItemRendered, onItemSelectionChanged,
onSelectAllValueChanged, onSelectionChanged.

Verified runtime defaults are null in tree_view.base.ts
(onItemSelectionChanged, onItemExpanded, onItemCollapsed,
onSelectAllValueChanged), collection_widget.base.ts (onItemClick,
onItemContextMenu, onItemHold, onItemRendered — already widened in a
prior batch), and collection_widget.edit.ts (onSelectionChanged).
Widened each type with `| null`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warnings for 4 event handler options
in js/ui/menu.d.ts: onSubmenuHidden, onSubmenuHiding, onSubmenuShowing,
onSubmenuShown.

Verified runtime defaults are null in js/__internal/ui/menu/menu.ts
_getDefaultOptions(). Widened each type with `| null` and removed the
now-stale @ts-expect-error suppressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warnings for 5 event handler options
in js/ui/context_menu.d.ts: onHidden, onHiding, onPositioning, onShowing,
onShown.

Verified runtime defaults are null in
js/__internal/ui/context_menu/context_menu.ts _getDefaultOptions().
Widened each type with `| null`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warning for onItemTitleClick in
js/ui/accordion.d.ts.

Verified runtime default is null in js/__internal/ui/accordion.ts
_getDefaultOptions(). Widened the type with `| null` and removed the
now-stale @ts-expect-error suppression.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warnings for 3 event handler options
in js/ui/tab_panel.d.ts: onTitleClick, onTitleHold, onTitleRendered.

Verified runtime defaults are null in
js/__internal/ui/tab_panel/tab_panel.ts _getDefaultOptions(). Widened
each type with `| null` and removed the now-stale @ts-expect-error
suppressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warning for onClick in js/ui/button.d.ts.

Verified runtime: js/__internal/ui/button/button.tsx's defaultButtonProps
has no onClick entry, so the ComponentWrapper-merged _getDefaultOptions()
never sets onClick, meaning .option('onClick') stays undefined until
explicitly assigned (same "no explicit null in _getDefaultOptions ->
undefined" case as the buttons field in ui.drop_down_editor.d.ts, per the
convention doc). The previous `@default null` was inaccurate; corrected
to `@default undefined` and widened the type with `| undefined`.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warnings for 2 event handler options
in js/ui/button_group.d.ts: onItemClick, onSelectionChanged.

Verified runtime defaults are null in js/__internal/ui/button_group.ts
_getDefaultOptions(). Widened each type with `| null` and removed the
now-stale @ts-expect-error suppressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warnings in js/ui/action_sheet.d.ts:
- onCancelClick (widget-level option): verified runtime default is null
  in js/__internal/ui/action_sheet.ts _getDefaultOptions(); widened the
  type with `| null` and removed the now-stale @ts-expect-error
  suppression.
- onClick (dxActionSheetItem property, Category B per the optional-fields
  typing convention): this is a per-item data field with no widget-level
  default (used only as a point-of-use fallback in the item template, not
  stored via _getDefaultOptions), so `.option()` never returns it. Removed
  the inaccurate `@default null` tag; the type is left unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warning for onContentReady in
js/ui/speed_dial_action.d.ts.

Verified runtime default is null in
js/__internal/ui/speed_dial_action/m_speed_dial_action.ts
_getDefaultOptions(). Widening only the local override initially broke
the WidgetProperties<any> constraint check in
m_speed_dial_action.ts (`class SpeedDialAction extends Widget<Properties>`),
because dxSpeedDialActionOptions.onContentReady overrides the base
WidgetOptions.onContentReady (js/ui/widget/ui.widget.d.ts), which itself
had the exact same pre-existing jsdoc-default-matches-type warning
(`@default null` but no `| null` in the type) and a confirmed `null`
runtime default in js/__internal/core/widget/widget.ts
_getDefaultOptions(). Per user decision, widened the shared base
WidgetOptions.onContentReady with `| null` as well, which is the root
cause fix and keeps the override compatible.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixed jsdoc-default-matches-type warnings for 4 event handler options
in js/ui/popup.d.ts: onResize, onResizeEnd, onResizeStart, onTitleRendered.

Verified runtime defaults are null in js/__internal/ui/popup/popup.ts
_getDefaultOptions(). Widened each type with `| null` and removed a
now-stale @ts-expect-error in js/__internal/ui/lookup.ts (its popup
options literal sets onTitleRendered: null directly).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Widens the types of maxSize and minSize options to number | null
in js/ui/drawer.d.ts to match their verified runtime default value of null
in js/__internal/ui/drawer/drawer.ts.
Also removes now-stale @ts-expect-error suppressions in drawer.ts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…undefined

Corrects JSDoc @default from null to undefined and widens types
to | undefined for onResize, onResizeEnd, onResizeStart,
onItemExpanded, and onItemCollapsed in js/ui/splitter.d.ts to
match their verified runtime default value of undefined in
js/__internal/ui/splitter/splitter.ts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@@ -28,7 +28,7 @@ export interface dxTextEditorOptions<TComponent> extends EditorOptions<TComponen
* @default undefined
* @public
*/
buttons?: Array<string | TextBoxPredefinedButton | TextEditorButton>;
buttons?: Array<string | TextBoxPredefinedButton | TextEditorButton> | undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

excessive undefined

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The similar reason - #34241 (comment)**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

undefined is necessary here because if you're using strict mode, ? is no longer interpreted as undefined. Consequently, a user in strict mode won't be able to assign the value undefined, which will result in an error.

I can send you a synthetic example. Let me know if you'd like one.

* @public
*/
onClick?: ((e: ClickEvent) => void);
onClick?: ((e: ClickEvent) => void) | undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not null?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

because default undefined and it can be undefined in runtime. And for null we need to add onClick: null here https://github.com/DevExpress/DevExtreme/blob/main/packages/devextreme/js/__internal/ui/button/button.tsx#L104

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I mean undefined is already set by ?:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yep, my fold, it's the same issue. We have custom eslint rule, that checks for the presence of the @default option within a union.

it works for any whitout | null and for option?: CustomType whitout | undefined

Comment thread packages/devextreme/js/ui/form.d.ts Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 09:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

getDisplayFormat(displayFormat: Format): Format {
return displayFormat;
getDisplayFormat(displayFormat?: Format | null): Format {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about return displayFormat ?? 'shortdate';?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

display format might be an empty string

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Null coalescing operator affects only null values:
image

@pharret31 pharret31 Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

that's why
'' ?? 'shortdate'
will be
''
which might not be correct here

@dmlvr could you recheck this place?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed to return displayFormat || 'shortdate';

Comment thread packages/devextreme/js/__internal/ui/form/form.layout_manager.ts Outdated
Comment thread packages/devextreme/js/__internal/ui/form/form.layout_manager.ts Outdated
Comment thread packages/devextreme/js/__internal/ui/form/form.ts Outdated
Comment thread packages/devextreme/js/__internal/ui/list/list.base.ts
Comment thread packages/devextreme/js/__internal/ui/list/list.edit.search.ts Outdated
Comment thread packages/devextreme/js/__internal/ui/map/map.ts Outdated
Comment thread packages/devextreme/js/ui/form.d.ts Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 10:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings July 10, 2026 12:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings July 10, 2026 12:47

@mpreyskurantov mpreyskurantov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

blocked,
should be a feature branch from the upstream remote (not a fork),
in the feature/* name format

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copilot AI review requested due to automatic review settings July 10, 2026 12:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants