Skip to content

JestMatchersShape<Matchers<void, HTMLElement>, Matchers<Promise<void>, HTMLElement>> doesn't has toBeVisible / toBeInDocument attributes #178

Closed
@anyexinglu

Description

@anyexinglu
  • @testing-library/jest-dom version: 4.2.4
  • node version: 10.16.0
  • npm (or yarn) version: yarn v1.19.1

Relevant code or config:

// menu.test.tsx
expect(getByText('Option 5')).toBeVisible()

// scripts/expect.ts
import '@testing-library/jest-dom/extend-expect'

// jest.config.ts
setupFilesAfterEnv: ['<rootDir>/scripts/expect.ts']

What you did:

I configure the @testing-library/jest-dom/extend-expect following README.md Usage - 1

What happened:

The typescript definition doesn't work:

类型“JestMatchersShape<Matchers<void, HTMLElement>, Matchers<Promise<void>, HTMLElement>>”上不存在属性“toBeVisible”。ts(2339)

image

In English, the error means JestMatchersShape<Matchers<void, HTMLElement>, Matchers<Promise<void>, HTMLElement>> doesn't has toBeVisible / toBeInDocument attributes

Related issue:

It seems pointed out before, but the solution doesn't work

#11 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions