Skip to content

Chore(deps): Update TypeScript to version 6.0.2 and adjust related types#1287

Merged
shm11C3 merged 2 commits into
developfrom
chore/update-typescript
Mar 25, 2026
Merged

Chore(deps): Update TypeScript to version 6.0.2 and adjust related types#1287
shm11C3 merged 2 commits into
developfrom
chore/update-typescript

Conversation

@shm11C3

@shm11C3 shm11C3 commented Mar 24, 2026

Copy link
Copy Markdown
Owner

Summary

Related Issues

Type of Change

  • Bug fix (fix/ branch)
  • New feature (feat/ branch)
  • Refactoring (refactor/ branch)
  • Documentation (docs/ branch)
  • Dependencies update
  • Other (chore/ branch)

Screenshots / Videos

Test Plan

  • Manual testing
  • Unit tests

Checklist

  • Self-reviewed the code
  • Linting and formatting pass (npm run lint && npm run format / cargo tauri-lint && cargo tauri-fmt)
  • Tests pass (npm test / cargo tauri-test)
  • No new warnings or errors

Copilot AI review requested due to automatic review settings March 24, 2026 18:36
@github-actions github-actions Bot added dependencies Pull requests that update a dependency file frontend labels Mar 24, 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

This PR updates the frontend toolchain to a newer TypeScript version and adjusts a few DOM/Node typing mismatches that become more visible with stricter/updated TypeScript typings.

Changes:

  • Bump typescript dependency from ^5.9.3 to ^6.0.2.
  • Replace NodeJS.Timeout timer handle annotations with ReturnType<typeof setTimeout/setInterval> in hooks/components.
  • Update test mocking to use globalThis.IntersectionObserver instead of global.IntersectionObserver.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/hooks/useWindowSize.ts Updates timeout handle typing to be environment-agnostic.
src/hooks/useStickyObserver.test.ts Uses globalThis for IntersectionObserver mocking.
src/features/hardware/insights/Insights.tsx Updates interval handle typing to be environment-agnostic.
package.json Attempts to bump TypeScript to ^6.0.2.
package-lock.json Locks TypeScript to 6.0.2 and includes lockfile metadata updates.
Comments suppressed due to low confidence (2)

src/hooks/useWindowSize.ts:33

  • timeoutId is declared without an initializer, but it's cleared in both handleResize and the effect cleanup. At runtime this means clearTimeout may receive undefined, while the variable is typed as a non-optional ReturnType<typeof setTimeout>. Initialize it to undefined/null and guard before clearing (or give it an initial setTimeout value) so the runtime value matches the declared type.
    let timeoutId: ReturnType<typeof setTimeout>;

    const handleResize = () => {
      clearTimeout(timeoutId);
      timeoutId = setTimeout(() => {

src/features/hardware/insights/Insights.tsx:329

  • The interval is only cleared on mouse/touch end. If the component unmounts (route change/tab switch) while the interval is running, it will keep firing and call setOffset on an unmounted component. Add an effect cleanup to clear any active interval on unmount (or store the interval handle in a ref and always clear it in cleanup).
  const [intervalId, setIntervalId] = useState<ReturnType<
    typeof setInterval
  > | null>(null);
  const { t } = useTranslation();

  const handleMouseDown = (increment: number) => {
    if (intervalId) return;
    const id = setInterval(() => {
      setOffset((prev) => Math.max(0, prev + increment));
    }, 100);
    setIntervalId(id);
  };

  const handleMouseUp = () => {
    if (intervalId) {
      clearInterval(intervalId);
      setIntervalId(null);
    }
  };

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 99.09% (🎯 60%) 990 / 999
🔵 Statements 98.87% (🎯 60%) 1051 / 1063
🔵 Functions 98.79% (🎯 60%) 245 / 248
🔵 Branches 93.96% (🎯 60%) 327 / 348
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/hooks/useWindowSize.ts 100% 100% 100% 100%
Generated in workflow #2557 for commit 2f23b59 by the Vitest Coverage Report Action

@shm11C3 shm11C3 enabled auto-merge (squash) March 25, 2026 17:30
@shm11C3 shm11C3 merged commit 043fd35 into develop Mar 25, 2026
18 checks passed
@shm11C3 shm11C3 deleted the chore/update-typescript branch March 25, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants