Skip to content

[7408] Typescript: API Modules - Utils#7409

Merged
n-lark merged 5 commits into
mainfrom
7408-ts-api-utils
Jun 17, 2026
Merged

[7408] Typescript: API Modules - Utils#7409
n-lark merged 5 commits into
mainfrom
7408-ts-api-utils

Conversation

@n-lark

@n-lark n-lark commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

See #7408 (comment)

Related Issue(s)

Resolves #7408

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@n-lark n-lark requested a review from cstns June 9, 2026 20:30
@n-lark n-lark self-assigned this Jun 9, 2026
@n-lark n-lark marked this pull request as draft June 9, 2026 20:54
@n-lark n-lark removed the request for review from cstns June 9, 2026 20:54
@n-lark n-lark marked this pull request as ready for review June 10, 2026 15:07
@n-lark n-lark requested review from Steve-Mcl, cstns and hardillb June 10, 2026 15:07
@cstns

cstns commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

the utils directory should also be repurposed to composables as that's the vue way of tackling helpers

@n-lark

n-lark commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

the utils directory should also be repurposed to composables as that's the vue way of tackling helpers

@cstns I do think that is out of scope for this work since we are just converting utils to typescript. Would you like me to make a separate ticket for that?

@cstns

cstns commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Yes please, that's what I meant. Excuse my bluntness

@n-lark

n-lark commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Follow up here: Repurpose src/utils into composables #7437

@n-lark n-lark requested a review from andypalmi June 12, 2026 15:25
Comment thread frontend/src/utils/InstanceStateMutator.ts Outdated
Comment thread frontend/src/utils/daysSince.ts Outdated
Comment thread frontend/src/utils/elapsedTime.ts Outdated
Comment thread frontend/src/utils/snapshot.ts Outdated
@andypalmi

Copy link
Copy Markdown
Contributor

This looks good, and I like that the .js to .ts switch didn't require changing any of the files that import these utils. I ran the frontend tests locally and all 517 pass, and the converted files type-check cleanly.

One thing I noticed is more about the TypeScript migration overall than this PR specifically: nothing in CI actually type-checks our .ts files yet. The lint script only looks at .js and .vue files, and there's no tsc/vue-tsc script in package.json. The build (webpack) compiles the .ts files but doesn't fail on type errors, so the types we're adding aren't really being checked anywhere. For example, there's already a type error in MqttExpertTopicHelper.ts that no check is catching today.

Would it be worth adding a vue-tsc --noEmit step as part of this migration work, even if we don't make it blocking at first? Otherwise we're adding types without anything verifying them. I'm happy to open a separate issue for it so this PR can stay focused.

@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.88%. Comparing base (a5aebfe) to head (a8ecdff).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7409   +/-   ##
=======================================
  Coverage   76.88%   76.88%           
=======================================
  Files         410      410           
  Lines       20939    20939           
  Branches     5098     5098           
=======================================
  Hits        16099    16099           
  Misses       4840     4840           
Flag Coverage Δ
backend 76.88% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@n-lark

n-lark commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Hey @andypalmi solid point - I created a follow up here for that Typescript: API Modules > Enforce TypeScript checks in CI #7552

Rest of feedback has also been addressed thanks!

@andypalmi andypalmi 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.

Looks good! Happy to approve

@n-lark n-lark merged commit 525a175 into main Jun 17, 2026
35 of 38 checks passed
@n-lark n-lark deleted the 7408-ts-api-utils branch June 17, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Typescript: API Modules - Utils

3 participants