yarn test, it would return the following error:
Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object
It took me a while, but I figured out that was because of the line
import App from './App'; in
App.test.tsx, which couldn’t tell the difference between
App.tsx – so it defaulted to
So now, if I use in
import App from './App.tsx';,
yarn test will run just fine – except my editor (VSCode) is giving me an error because of the file extension:
An import path cannot end with a '.ts' extension. Consider importing './App' instead.ts(2691).
Has anybody else encountered this problem? Is there a good way to satisfy typescript in this scenario?
Because I don’t think the app will work if I rename App.tsx to something else…