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

Extend expect 28 types directly #2

Closed
wants to merge 3 commits into from
Closed

Extend expect 28 types directly #2

wants to merge 3 commits into from

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented Oct 31, 2022

This copies the type definitions from definitely-typed into the repo and augments the expect module with the custom matchers using the non-global approach possible in expect 28+.

Similar to testing-library#483.

@IanVS
Copy link
Member Author

IanVS commented Oct 31, 2022

@yannbf, from my local testing this seems like it will work. Here's what I did:

  • Checkout this branch, and build it (yarn build).
  • In your own project, find @testing-library/jest-dom in node_modules, copy over the new dist, package.json, and index.d.ts.
  • Find and remove node_modules/@types/testing-library__jest-dom, just to be safe.
  • Also in your project, use the canary version of "@storybook/expect": "28.1.4-canary.0" (may need to use yarn resolutions or npm overrides).

Then, you should still get autocompletion of the custom matchers.

image

@IanVS IanVS changed the title Start converting to typescript Extend expect 28 types directly Oct 31, 2022
@yannbf
Copy link
Member

yannbf commented Jan 11, 2023

Hey @IanVS what do you think we need to do with this PR? I remember having discussions with the testing-lib team and apparently they're moving jest-dom into dom-assertions which will allow them to properly upgrade to TS, but I'm not sure if we need to wait?

@IanVS
Copy link
Member Author

IanVS commented Jan 11, 2023

I think this isn't necessary if we go with storybookjs/expect#12. As far as I can tell, no progress is being made in jest-dom nor dom-assertions.

@IanVS IanVS closed this Sep 12, 2023
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