Skip to content

Fix Typescript errors and clean up TS configs#2685

Merged
fredrikekelund merged 19 commits intotrunkfrom
f26d/fix-type-errors
Mar 9, 2026
Merged

Fix Typescript errors and clean up TS configs#2685
fredrikekelund merged 19 commits intotrunkfrom
f26d/fix-type-errors

Conversation

@fredrikekelund
Copy link
Contributor

@fredrikekelund fredrikekelund commented Mar 2, 2026

Related issues

Fixes STU-1373

Proposed Changes

We currently have a few TS errors in our code. This PR addresses that with the following changes:

  • Add a typecheck npm script.
  • Update AGENTS.md to tell agents to do type checking.
  • Run that script as part of the lint CI job.
  • Removed "*": [ "node_modules/*" ] resolvers in tsconfig.json files. This means it's no longer possible to import any code from node_modules files. Instead, we use regular module resolution to import available modules.
    • This may sound like a big change, but it's really not. I only had to apply a minor edit to a single file (use-update-button-tooltip.ts) to make this work.
  • Install @types/glob and wpcom to prevent TS from complaining.
  • Externalize yargs dependency during build. This is a different way of tackling the issue raised in Fix Studio CLI yargs locale strings displaying in English #2609. I had to address this because yarg's updateStrings function didn't play nice with the type definitions from apps/cli/lib/i18n.ts. By not bundling the yargs code, we sidestep the problem altogether.
  • Fix all other type errors.

Testing Instructions

CI should pass.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@fredrikekelund fredrikekelund requested a review from a team March 2, 2026 10:41
@fredrikekelund fredrikekelund self-assigned this Mar 2, 2026
@fredrikekelund fredrikekelund marked this pull request as ready for review March 3, 2026 10:46
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Mar 3, 2026

📊 Performance Test Results

Comparing 8ac4a6f vs trunk

site-editor

Metric trunk 8ac4a6f Diff Change
load 1473.00 ms 1763.00 ms +290.00 ms 🔴 19.7%

site-startup

Metric trunk 8ac4a6f Diff Change
siteCreation 6058.00 ms 7075.00 ms +1017.00 ms 🔴 16.8%
siteStartup 3959.00 ms 3944.00 ms -15.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

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

Changes look good. I tested it the app by starting a site and logging in. I also tried executing the new CLI command npm run typecheck.

@fredrikekelund
Copy link
Contributor Author

Thanks for the review, @sejas 🙏

@fredrikekelund fredrikekelund merged commit 6101db6 into trunk Mar 9, 2026
11 checks passed
@fredrikekelund fredrikekelund deleted the f26d/fix-type-errors branch March 9, 2026 12:09
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.

3 participants