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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when use jest-environment-jsdom in Typescript #8347

Closed
lh0x00 opened this issue Apr 19, 2019 · 4 comments
Closed

Error when use jest-environment-jsdom in Typescript #8347

lh0x00 opened this issue Apr 19, 2019 · 4 comments

Comments

@lh0x00
Copy link
Contributor

lh0x00 commented Apr 19, 2019

馃悰 Bug Report

When I import and use jest-environment-jsdom in my project, using Typescript to build will receive a message error:

TS2416: Property 'global' in type 'JSDOMEnvironment' is not assignable to the same property in base type 'JestEnvironment'.

It's an error when build to publish right?

To Reproduce

In types of build missing a comment // @ts-ignore, check here:
https://unpkg.com/jest-environment-jsdom@24.7.1/build/index.d.ts

@SimenB
Copy link
Member

SimenB commented Apr 19, 2019

Ah, I didn't know ignores were not emitted... (microsoft/TypeScript#20360)

We should make sure this works properly in Jest 25.

A PR fixing the type issue is very much welcome, of course!

@lh0x00
Copy link
Contributor Author

lh0x00 commented Apr 20, 2019

@SimenB I created a PR to fix it, please review and give me a comment. Thank you very much!

@SimenB
Copy link
Member

SimenB commented Apr 21, 2019

#8352

@SimenB SimenB closed this as completed Apr 21, 2019
SimenB pushed a commit that referenced this issue Apr 21, 2019
* Declare global prototype in JSDOMEnvironment to fix issue #8347

* Change type to check isWin and remove set global to null

* Add description of PR to the changelog

* Set global to `null` in teardown process and uncheck is window for global prototype
@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 May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants