Skip to content

Core(Events): remove m_ prefix & convert into ES6 syntax and improve typing - #34940

Merged
EugeniyKiyashko merged 2 commits into
mainfrom
typescript/events/es6_emitters
Aug 28, 2026
Merged

Core(Events): remove m_ prefix & convert into ES6 syntax and improve typing#34940
EugeniyKiyashko merged 2 commits into
mainfrom
typescript/events/es6_emitters

Conversation

@EugeniyKiyashko

@EugeniyKiyashko EugeniyKiyashko commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@EugeniyKiyashko
EugeniyKiyashko requested a review from a team as a code owner August 26, 2026 21:35
Copilot AI lite review requested due to automatic review settings August 26, 2026 21:35
@github-actions github-actions Bot added the .d.ts label Aug 26, 2026
@EugeniyKiyashko
EugeniyKiyashko force-pushed the typescript/events/es6_emitters branch from 90bdc62 to 8e84993 Compare August 26, 2026 21:39

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.

Pull request overview

Refactors DevExtreme’s internal events infrastructure by migrating the emitter and pointer-strategy hierarchies from Class.inherit() to native ES6 classes, while tightening TypeScript typings across the events pipeline and removing several @ts-expect-error workarounds.

Changes:

  • Converted core event emitters (click/hold/drag/swipe/transform/gesture*), pointer strategies, and related helpers to ES6 classes with explicit TS types.
  • Improved type declarations (eventDelta, dxElementWrapper.is) to match runtime behavior and eliminate downstream TS suppressions.
  • Updated tests and internal integration points (e.g., ComponentWrapper, QUnit emitter subclass) to work with native class constructors/statics.

Reviewed changes

Copilot reviewed 22 out of 24 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/devextreme/testing/tests/DevExpress.ui.events/eventsInteraction.tests.js Updates test-only emitter subclassing to use constructor/super with native classes.
packages/devextreme/js/core/renderer.d.ts Widens dxElementWrapper.is() to accept Element (aligns with runtime behavior).
packages/devextreme/js/common/core/events/utils/index.d.ts Fixes eventDelta(from, to) signature to accept {x,y,time} objects (aligns with runtime usage).
packages/devextreme/js/__internal/ui/text_box/text_editor.base.ts Removes a now-unneeded TS suppression due to widened is() typing.
packages/devextreme/js/__internal/events/pointer/m_touch.ts Migrates touch pointer strategy to ES6 class and adds stronger typing for normalization.
packages/devextreme/js/__internal/events/pointer/m_observer.ts Converts pointer observer from function-constructor to class, adds typed event map and methods.
packages/devextreme/js/__internal/events/pointer/m_mouse.ts Migrates mouse pointer strategy to ES6 class and types observer usage.
packages/devextreme/js/__internal/events/pointer/m_mouse_and_touch.ts Migrates combined strategy to ES6 class and modernizes state handling.
packages/devextreme/js/__internal/events/pointer/m_base.ts Converts base pointer strategy to ES6 class and introduces typed event/init shapes.
packages/devextreme/js/__internal/events/m_transform.ts Converts transform emitter to ES6 class and introduces typed vector math structures.
packages/devextreme/js/__internal/events/m_swipe.ts Converts swipe emitter to ES6 class and introduces typed strategies/event data.
packages/devextreme/js/__internal/events/m_hover.ts Replaces Class.inherit hover events with ES6 classes and typed handler storage.
packages/devextreme/js/__internal/events/m_hold.ts Converts hold emitter to ES6 class and removes incorrect eventDelta suppression via fixed typings.
packages/devextreme/js/__internal/events/m_drag.ts Converts drag emitter to ES6 class and adds explicit types for drop target registration/config.
packages/devextreme/js/__internal/events/m_dblclick.ts Converts dblclick implementation to ES6 class with explicit event typing.
packages/devextreme/js/__internal/events/m_contextmenu.ts Converts context menu event implementation to ES6 class with typed handlers.
packages/devextreme/js/__internal/events/m_click.ts Converts click emitter to ES6 class; tightens typing around node-disposing subscriptions (keeps known latent bug suppressed as documented).
packages/devextreme/js/__internal/events/gesture/m_emitter.gesture.ts Converts gesture emitter to ES6 class, adds explicit gesture event/direction types, and moves statics into class body.
packages/devextreme/js/__internal/events/gesture/m_emitter.gesture.scroll.ts Converts scroll emitter + locker hierarchy to ES6 classes and introduces typed locker/config/event shapes.
packages/devextreme/js/__internal/events/core/m_keyboard_processor.ts Converts keyboard processor to ES6 class, adds options interface, and exposes statics.
packages/devextreme/js/__internal/events/core/m_emitter.ts Converts base Emitter to ES6 class and defines core event/config typing used throughout the pipeline.
packages/devextreme/js/__internal/events/core/m_emitter.feedback.ts Converts feedback emitter and helper to ES6 classes; moves lock to a static class method.
packages/devextreme/js/__internal/events/core/m_emitter_registrator.ts Converts event manager/registrator to ES6 class with improved typing for emitter registration and event flow.
packages/devextreme/js/__internal/core/r1/component_wrapper.ts Removes any cast by using the new typed KeyboardProcessor.createKeyDownOptions.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/devextreme/js/__internal/events/core/keyboard_processor.ts
Copilot AI review requested due to automatic review settings August 26, 2026 21:40

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.

Pull request overview

Copilot reviewed 22 out of 24 changed files in this pull request and generated 4 comments.

Comment thread packages/devextreme/js/__internal/events/pointer/m_observer.ts
Comment thread packages/devextreme/js/__internal/events/hover.ts
Comment thread packages/devextreme/js/__internal/events/pointer/base.ts
Comment thread packages/devextreme/js/__internal/events/pointer/mouse_and_touch.ts Outdated
Copilot AI review requested due to automatic review settings August 27, 2026 03:55
@EugeniyKiyashko
EugeniyKiyashko force-pushed the typescript/events/es6_emitters branch from 8e84993 to 47c87de Compare August 27, 2026 03:55
@EugeniyKiyashko
EugeniyKiyashko requested a review from a team as a code owner August 27, 2026 03:55
@EugeniyKiyashko EugeniyKiyashko changed the title Core(Events): convert emitter & pointer hierarchies into ES6 classes and improve typing Core(Events): remove m_ prefix & convert into ES6 syntax and improve typing Aug 27, 2026
@EugeniyKiyashko EugeniyKiyashko self-assigned this Aug 27, 2026

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.

Pull request overview

Copilot reviewed 66 out of 69 changed files in this pull request and generated no new comments.

Suppressed comments (2)

packages/devextreme/js/__internal/events/pointer/mouse_and_touch.ts:92

  • MouseAndTouchStrategy.dispose() calls super.dispose() without forwarding the element argument. For noBubble pointer events (dxpointerenter/dxpointerleave), BaseStrategy.dispose() needs the element to unsubscribe; missing it can leave handlers attached or call eventsEngine.off with an undefined target.
    super.dispose();
    this._skipNextEvents = false;
    this._mouseLocked = false;
    clearTimeout(this._unlockMouseTimer);
  }

packages/devextreme/js/__internal/events/core/keyboard_processor.ts:34

  • createKeyDownOptions assigns normalizeKeyName(e) (typed as string | undefined in events/utils) to KeyboardKeyDownEvent.keyName (typed as string) and suppresses it with @ts-expect-error. Prefer providing a fallback string here so the runtime value matches the declared type and the suppression can be removed.

@EugeniyKiyashko
EugeniyKiyashko force-pushed the typescript/events/es6_emitters branch from 47c87de to a3659e9 Compare August 27, 2026 04:03
Copilot AI review requested due to automatic review settings August 27, 2026 04:03

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.

Pull request overview

Copilot reviewed 66 out of 69 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

packages/devextreme/js/__internal/events/click.ts:52

  • subscribeNodesDisposing() returns { onceCallback, nodes }, but the code destructures { nodes, callback } (and even suppresses it with @ts-expect-error). At runtime callback is undefined, so unsubscribeNodesDisposing() won’t remove the specific handler and may detach unintended listeners depending on how eventsEngine.off() treats an undefined callback.

Comment thread packages/devextreme/js/__internal/events/swipe.ts
@EugeniyKiyashko
EugeniyKiyashko force-pushed the typescript/events/es6_emitters branch from a3659e9 to e3b1dbc Compare August 27, 2026 08:18
Copilot AI review requested due to automatic review settings August 27, 2026 08:18

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.

Pull request overview

Copilot reviewed 66 out of 69 changed files in this pull request and generated no new comments.

Suppressed comments (1)

packages/devextreme/js/__internal/events/click.ts:52

  • The unsubscribe path uses callback, but subscribeNodesDisposing() returns { onceCallback, nodes } (see js/__internal/events/utils/m_event_nodes_disposing.ts). As written, callback is always undefined, so unsubscribeNodesDisposing() will remove all dxremove handlers from the nodes (or fail to remove the intended one), which is a functional bug and can break other subscriptions.

Copilot AI review requested due to automatic review settings August 28, 2026 06:47
@EugeniyKiyashko
EugeniyKiyashko force-pushed the typescript/events/es6_emitters branch from e3b1dbc to a731e5c Compare August 28, 2026 06:47
@EugeniyKiyashko
EugeniyKiyashko force-pushed the typescript/events/es6_emitters branch from a731e5c to e766a32 Compare August 28, 2026 06:48

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.

Pull request overview

Copilot reviewed 66 out of 69 changed files in this pull request and generated no new comments.

Suppressed comments (1)

packages/devextreme/js/__internal/events/click.ts:54

  • The nodes-disposing subscription returned by subscribeNodesDisposing() contains onceCallback, but this code destructures callback (which is always undefined). That makes unsubscribeNodesDisposing() call off() with an undefined handler, which can remove all dxremove handlers from the nodes and break cleanup for subsequent clicks.

@EugeniyKiyashko
EugeniyKiyashko merged commit df1db07 into main Aug 28, 2026
103 checks passed
@EugeniyKiyashko
EugeniyKiyashko deleted the typescript/events/es6_emitters branch August 28, 2026 10:02
alexslavr pushed a commit that referenced this pull request Aug 28, 2026
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.

4 participants