open-wc: Unused @ts-expect-error directive in @open-wc/testing-helpers

A change introduced in @open-wc/testing-helpers 1.8.9 (https://github.com/open-wc/open-wc/commit/88ffd995efeb94d79ee686f665d18e8ca405e3bc) is causing an error when running all our tests via jest. The addition of // @ts-expect-error produces this error:

Test suite failed to run

node_modules/@open-wc/testing-helpers/src/scopedElementsWrapper.js:32:1 - error TS2578: Unused '@ts-expect-error' directive.

32 // @ts-expect-error
 ~~~~~~~~~~~~~~~~~~~

The only way we can get around this error is by limiting the version of @open-wc/testing-helpers to 1.8.8

What is the purpose of the @ts-expect error ? Could @ts-ignore be used here instead?

Struggling to understand how to prevent this error as there seems to be no way to bypass it

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

Hmmm so the error (https://github.com/microsoft/TypeScript/issues/40110) is still there on 4.0.3. Which was sort of to be expected. I will create a PR to switch it with @ts-ignore for only this one, because the error is not thrown consistently across TS versions from the looks of it, which makes @ts-expect-error not the best choice here.

Raised a PR to fix it, so people can at least move to latest version of testing-helpers and not be blocked by this.

Would it be ok if I try a PR updating to typescript 4? Still sounds from what was said that this issue would be resolved in 4.1