Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 29, 2025

Resolves TypeScript compilation error TS2322 in PR #20847 where string | null was not assignable to keyof HTMLElementEventMap | null.

Changes

frontend/src/app/shared/helpers/event-helpers.ts

  • Cast parts[1] to EventType | undefined before nullish coalescing to match return type signature
  • Remove unnecessary as EventNamespace assertion (type alias to string)
// Before
const namespace = parts[0] as EventNamespace;
const type = parts[1] || null;

// After  
const namespace = parts[0];
const type = (parts[1] as EventType | undefined) ?? null;

The assertion is safe: NamespacedEvent is a template literal type ${EventType}.${EventNamespace} enforcing compile-time constraints on valid event names.

Original prompt

The TypeScript compilation errors in Pull Request #20847 (#20847) must be resolved. These errors include a TS2322 mismatch where 'string | null' is not assignable to 'keyof HTMLElementEventMap | null'. Additionally, object equality checks in JavaScript need to be updated to compare contents instead of identity. For example, replace 'x === []' with 'Array.isArray(x) && x.length === 0'. The fixes should ensure correct type handling and equality checks.

This pull request was created as a result of the following prompt from Copilot chat.

The TypeScript compilation errors in Pull Request #20847 (#20847) must be resolved. These errors include a TS2322 mismatch where 'string | null' is not assignable to 'keyof HTMLElementEventMap | null'. Additionally, object equality checks in JavaScript need to be updated to compare contents instead of identity. For example, replace 'x === []' with 'Array.isArray(x) && x.length === 0'. The fixes should ensure correct type handling and equality checks.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits October 29, 2025 20:29
- Fix keyPressFn callback registration in timeline cell mouse handler
- Fix selection state to update all matching rows, not just first
- Fix timing of hidden attribute in persistent toggle animations
- Fix getNamespaceAndType to properly return null for namespace-only events

Co-authored-by: myabc <[email protected]>
The original jQuery code `$element.children().width()` gets the width of the
first child element, not the sum of all children. This was incorrectly
translated to summing all children widths, which would cause timeline
rendering issues.

Co-authored-by: myabc <[email protected]>
@github-actions
Copy link


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copilot AI changed the title [WIP] Fix TypeScript compilation errors and object equality checks Fix TS2322 type error in event-helpers.ts getNamespaceAndType method Oct 29, 2025
Copilot AI requested a review from myabc October 29, 2025 21:42
Copilot finished work on behalf of myabc October 29, 2025 21:42
@myabc myabc marked this pull request as ready for review October 29, 2025 22:14
@myabc
Copy link
Contributor

myabc commented Oct 29, 2025

Merged into #20847
Please continue work there.

@myabc myabc closed this Oct 29, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants