-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Typing failure on expect().toThrow(Error) with explicit imports #10087
Comments
This is reproducible with just the $ mkdir repro
$ cd repro
$ npm init
$ npm i --save-dev typescript expect
$ vi test.ts Write the following into the import expect from 'expect';
function oops() {
throw new Error('oops');
}
expect(oops).toThrow(Error); Then try to compile it with
|
PR welcome 🙂 |
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. |
🐛 Bug Report
Here's the minimum reproducible snippet.
My project is written in Typescript and I'm using
jest
along withts-jest
.After running the test file, an error is shown.
However, if I remove the first line which makes the test using jest globals, everything works fine.
That is,
I found that source definition of
expect
is different between two tests.With explicit imports, the definition is coming from
node_modules\expect\build\types.d.ts
, while with implicit imports, the definition is coming fromnode_modules\@types\jest\index.d.ts
.To Reproduce
Steps to reproduce the behavior:
Expected behavior
No typing errors.
envinfo
The text was updated successfully, but these errors were encountered: