TypeScript error - Property 'text' does not exist on type 'Include'.
raptoria opened this issue · 3 comments
raptoria commented
It seems like something might be missing from @types/chai-enzyme? Besides the TypeScript error, the code runs fine..
My test:
it('Has File', () => {
const wrapper = render(<FileMenu />);
expect(wrapper.find('.dropdown')).to.contain.text('File'); //line 17..
});
ERROR in ./test/components/FileMenu/FileMenuTest.tsx
(17,50): error TS2339: Property 'text' does not exist on type 'Include'.
raptoria commented
In the documentation, it shows:
expect(wrapper.find('#child')).to.contain.text('Te')
According to:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/chai-enzyme/index.d.ts
The Text attribute exists on Assertion and not Include (hence the error)
Contain, which is an Include, expects a selector as an argument
ljharb commented
I'd file this on the dt repo, since those types aren't necessarily maintained by the chai-enzyme maintainers.
raptoria commented
OK