Using typescript to define a test outputs Type assertion using the '<>' syntax is forbidden. Use the 'as' syntax instead. error.
./app.test.ts
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const div = document.createElement('div');
ReactDOM.render(<App />, div); // here the error is produced
});
How should the component be defined in Typescript?
Example code from CRA Facebook page
edit: Accepted answer by @rzelek pointed in the right direction.
As defined in the JSX handbook the compiler options define the way your JSX is interpreted. In my case used "jsx": "react" so that means the method React.createElement() needs to be used in order to create a component (see table in JSX handbook):
final result: ./app.test.ts
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
it('renders without crashing', () => {
const app = React.createElement(App);
const div = document.createElement('div');
ReactDOM.render(app, div);
});