Jest: Error when use jest-environment-jsdom in Typescript

Created on 19 Apr 2019  路  3Comments  路  Source: facebook/jest

馃悰 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/[email protected]/build/index.d.ts

Bug Report Needs Repro Needs Triage

All 3 comments

Ah, I didn't know ignores were not emitted... (https://github.com/Microsoft/TypeScript/issues/20360)

We should make sure this works properly in Jest 25.

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

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

8352

Was this page helpful?
0 / 5 - 0 ratings