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

[Bug]: Expect.Matchers types broke in 27.3.0 #11985

Closed
mxschmitt opened this issue Oct 22, 2021 · 3 comments · Fixed by #11986
Closed

[Bug]: Expect.Matchers types broke in 27.3.0 #11985

mxschmitt opened this issue Oct 22, 2021 · 3 comments · Fixed by #11986

Comments

@mxschmitt
Copy link
Contributor

mxschmitt commented Oct 22, 2021

Version

27.3.0

Steps to reproduce

  1. create a foo.ts
  2. put this content in it
import type * as expect from 'expect';

type Foobar = expect.Matchers<{}>;

Expected behavior

no typing issues

Actual behavior

image

Additional context

It worked before. Seems like a regression introduced in #11949. Before that it was working.

Environment

Not relevant
@mrazauskas
Copy link
Contributor

Inside test-types directory add new file expect.test.ts file (this one is for expect package, because it is not possible to make similar import from globals, right?). Include the copyright lines and this:

import type * as expect from 'expect';

export type M = expect.Matchers<void, unknown>;
export type N = expect.Matchers<void>;
// @ts-expect-error
export type E = expect.Matchers<>;

The export ensures that defined but never used is silenced. expect-error is silencing the expected error. The line with type N will fail before your patch and will pass after.

Might be you found these already, adding just for completeness. Use yarn test-types to run the test. And keep in mind that you have to build the library to see any change in tests.

@mrazauskas
Copy link
Contributor

Oh.. Wrong place. This page was open, because I was copying your code (;

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants