Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extend-expect typings #182

Merged
merged 1 commit into from
Jan 16, 2020
Merged

Conversation

jgoz
Copy link
Collaborator

@jgoz jgoz commented Jan 16, 2020

What:

BREAKING CHANGE: moving typings to @types/testing-library__jest-dom (see DefinitelyTyped/DefinitelyTyped#37792)

Why:

#123.

How:

  • Deleted built-in TypeScript definitions
  • Opened PR in DefinitelyTyped with new definitions
  • Future PR: add dependency on @types/testing-library__jest-dom to this project

Checklist:

  • Documentation N/A
  • Tests N/A
  • Updated Type Definitions
  • Ready to be merged

After this PR, I think we can release version 5.0. Then the type definitions in the DefinitelyTyped PR will match the latest release. After that is merged, we can add the dependency and ship 5.0.1, finally closing the related issue.

BREAKING CHANGE: moving typings to @types/testing-library__jest-dom
Copy link
Member

@gnapse gnapse left a comment

Choose a reason for hiding this comment

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

Let me check if I understand it all:

  1. We merge this into next
  2. We then merge next into master as a breaking change, which will prompt the release of v5.0.0 (context for anyone reading this: next also includes right now Add jest extensions on main module #175 that's part of this process).
  3. We make a new PR that introduces the DT dev dependendency, and ship it as v5.0.1

The only question remaining then is: v5.0.0 will be a kinda broken release, right? It won't support TS and people using jest-dom with TS, if they happen to get jest-dom in the window of time when v5.0.0 is the latest version, right?

@jgoz
Copy link
Collaborator Author

jgoz commented Jan 16, 2020

Yeah, that’s right. Not ideal.

Instead of deleting the typings in this PR I could just have them apply to the index file instead of extend-expect. Then v5 would ship with typings. And 5.0.1 would swap the internal ones for the DT ones.

Thoughts on that?

@jgoz
Copy link
Collaborator Author

jgoz commented Jan 16, 2020

Actually, I'm backtracking that idea. Removing the typings is the correct change because that's ultimately our goal. Adding the dependency to @types/... is a convenience for users whose package managers hoist dependencies (npm, yarn) but some users will need to (or may want to) add the types dependency manually to their own projects.

There will be a bit of a gap where the typings are not available, but if we communicate that in the changelog, hopefully people will understand...

@gnapse gnapse merged commit c76f8c5 into testing-library:next Jan 16, 2020
@gnapse
Copy link
Member

gnapse commented Jan 16, 2020

Fair enough. I merged this and created #183 that would trigger the actual v5.0.0 release.

@gnapse
Copy link
Member

gnapse commented Jan 17, 2020

🎉 This PR is included in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@JasonMore
Copy link

JasonMore commented Jan 21, 2020

EDIT:
Digging through all the PRs, I see whats going on now. I installed npm i -D @testing-library/[email protected] which has the .d.ts file again.

--old--

This just bit me. Can you guys update the documentation on the new setup process? @gnapse @jgoz Right now I don't see any types definitions using the current documentation, I had to search the commit log

"devDependencies": {
    "@testing-library/jest-dom": "5.0.0",
Error:(66, 27) TS2339: Property 'toHaveTextContent' does not exist on type 'JestMatchersShape<Matchers<void, HTMLElement>, Matchers<Promise<void>, HTMLElement>>'.

@gnapse
Copy link
Member

gnapse commented Jan 22, 2020

@JasonMore v5.0.1 is out now, with types support back. Sorry for the inconvenience. And let us know of any remaining or new issues with this update.

ryota-murakami added a commit to laststance/react-typescript-todomvc-2022 that referenced this pull request Feb 18, 2020
javier901 added a commit to javier901/create-react-app-example that referenced this pull request Aug 28, 2022
frontend-provider added a commit to frontend-provider/react-app that referenced this pull request Sep 21, 2023
backend-devloper pushed a commit to backend-devloper/react-app that referenced this pull request Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants