Skip to content

Update and align @types/jest with jest runtime and remove ts-ignores - #1467

Closed
marcalexiei wants to merge 3 commits into
changesets:mainfrom
marcalexiei:feat/remove-ts-ignore
Closed

marcalexiei wants to merge 3 commits into
changesets:mainfrom
marcalexiei:feat/remove-ts-ignore

Conversation

@marcalexiei

@marcalexiei marcalexiei commented Sep 21, 2024 •

Copy link
Copy Markdown
Contributor
  • jest and @types/jest have been updated to the latest version (29.7.0)
    Previously the types version wasn't matching the runtime version
  • code now no longer contains @ts-ignore
    • In unit test they have been replaced with "type checkable" code using jest.mocked helper
    • source code has some @ts-ignore that were no longer valid
    • @ts-ignore that cannot be removed have been replaced with @ts-expect-error directive followed by an explanation

I had to enable skipLibCheck in tsconfig.json due to some types error coming from enquirer package.
I updated enquirer to 2.4.1 and the error is no longer present.
However updating this package in this PR seems out of scope so I opted to temporary disable typecheck.
(If you wish I can open a new PR after this one is merged)

#1467 (comment)

@changeset-bot

changeset-bot Bot commented Sep 21, 2024 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 89e06f2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov

codecov Bot commented Sep 21, 2024 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.04%. Comparing base (8ef697d) to head (89e06f2).
⚠️ Report is 60 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1467   +/-   ##
=======================================
  Coverage   81.04%   81.04%           
=======================================
  Files          54       54           
  Lines        2221     2221           
  Branches      657      662    +5     
=======================================
  Hits         1800     1800           
  Misses        417      417           
  Partials        4        4           

☔ View full report in Codecov by Sentry.
📢 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.

@marcalexiei
marcalexiei force-pushed the feat/remove-ts-ignore branch from c221fb0 to 1d7873f Compare October 7, 2024 07:02

@bluwy bluwy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The refactor for mock types looks really good. I've noticed some imports shifted around, do you mind putting the order back to reduce the diff? (I've noted them in the comments below)

Mainly this will help merging future changes that we're working on in the next branch. Thanks!

Comment thread packages/write/src/index.test.ts Resolved
@marcalexiei
marcalexiei force-pushed the feat/remove-ts-ignore branch from 1d7873f to 5308b31 Compare October 8, 2024 10:09

@marcalexiei marcalexiei left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Requested file imports have been reverted to their original order

@marcalexiei
marcalexiei requested a review from bluwy October 8, 2024 10:14
@marcalexiei

Copy link
Copy Markdown
Contributor Author

One last thing from the description:
Is ok to open the PR to update enquirer to remove skipLibCheck after this one has been merged?

@bluwy

bluwy commented Oct 8, 2024 •

Copy link
Copy Markdown
Member

I'm not the main maintainer around here, but I'd say go ahead! Maybe it's better to send the PR first and merge that first? So we don't have a short timeframe where we have to use skipLibCheck. The other maintainers may have opinions about skipLibCheck too that could delay merging this PR.

@marcalexiei
marcalexiei force-pushed the feat/remove-ts-ignore branch 2 times, most recently from e514f3f to 51be97d Compare October 8, 2024 17:01
@marcalexiei
marcalexiei force-pushed the feat/remove-ts-ignore branch from 51be97d to 31f064a Compare October 8, 2024 17:09
@marcalexiei

Copy link
Copy Markdown
Contributor Author

I rechecked the type errors and adding @types/node to the root with the version already installed on main solved the issue.

changesets/yarn.lock

Lines 2016 to 2019 in 7ccb22e

"@types/node@*", "@types/node@^12.7.1":
version "12.12.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.5.tgz#66103d2eddc543d44a04394abb7be52506d7f290"
integrity sha512-KEjODidV4XYUlJBF3XdjSH5FWoMCtO0utnhtdLf1AgeuZLOrRbvmU/gaRCVg7ZaQDjVf3l84egiY0mRNe5xE4A==

So now there is no need to use skipLibCheck!

@marcalexiei

This comment was marked as outdated.

@marcalexiei
marcalexiei requested a review from bluwy October 8, 2024 17:22
@marcalexiei

Copy link
Copy Markdown
Contributor Author

I noticed that enquirer has been updated, alongside @types/node, in the next branch via #1476.

If you prefer we can merge this PR into next instead of main,
if that is the case let me know and I'll rebase this branch on next.

@bluwy bluwy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You don't need to re-request review if there isn't any significant code change. It'll also be easier to review what changed if you push a new commit instead of force pushing.

@marcalexiei marcalexiei mentioned this pull request Oct 10, 2024
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.

2 participants