Utilizing the global package to incorporate certain enzyme methods in test files without the need for importing:
import { configure, shallow, render, mount } from 'enzyme';
.....
global.shallow = shallow;
global.render = render;
global.mount = mount;
This allows me to use:
const component = shallow(<Input {...props} />);
within my test file without explicitly importing the shallow
method
Unfortunately, typescript is not aware of these global variables, resulting in the following error message: [ts] Cannot find name 'shallow'.
How can I inform typescript about these global variables?