testing-library / react-testing-library

🐐 Simple and complete React DOM testing utilities that encourage good testing practices.

Home Page:https://testing-library.com/react

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeScript error with skipLibCheck false

eps1lon opened this issue · comments

          @eps1lon we see type errors since this change:
node_modules/@testing-library/react/types/index.d.ts:129:52 - error TS2344: Type 'Container' does not satisfy the constraint 'Element | DocumentFragment'.
  Type 'Document | Container' is not assignable to type 'Element | DocumentFragment'.
    Type 'Document' is not assignable to type 'Element | DocumentFragment'.
      Type 'Document' is missing the following properties from type 'Element': attributes, classList, className, clientHeight, and 100 more.
        Type 'Container' is not assignable to type 'DocumentFragment'.
          Type 'Document | Container' is not assignable to type 'DocumentFragment'.
            Type 'Document' is not assignable to type 'DocumentFragment'.
              Types of property 'ownerDocument' are incompatible.
                Type 'null' is not assignable to type 'Document'.

can be reproduced with:

mkdir check-testinglib
cd check-testinglib
npm init -y
npm i react react-dom @types/react @types/react-dom typescript @testing-library/react
npx tsc --init --outDir dist --skipLibCheck false
echo "export * from '@testing-library/react';" > test.ts
npx tsc --noEmit

Originally posted by @AviVahl in #1304 (comment)

Ah, I should have probably opened the issue. Thanks for that. Much appreciated.

thanks for the fix. any chance for a patch release?

thanks for the fix. any chance for a patch release?

This should be automatic but looks like our CI failed, I'll have a look.

@AviVahl Re-running did the trick, version 15.0.5 is released with that fix :) Sorry about that and thanks for the ping.