Change to typescript template

This commit is contained in:
2022-10-09 15:55:35 +02:00
parent 596c26de84
commit ea45516569
10 changed files with 70 additions and 482 deletions

View File

@@ -1,3 +1,4 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import App from './App';

View File

@@ -1,3 +1,4 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
@@ -7,7 +8,7 @@ function App() {
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"

View File

@@ -4,7 +4,9 @@ import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root'));
const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
);
root.render(
<React.StrictMode>
<App />

1
src/react-app-env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="react-scripts" />

View File

@@ -1,4 +1,6 @@
const reportWebVitals = onPerfEntry => {
import { ReportHandler } from 'web-vitals';
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
if (onPerfEntry && onPerfEntry instanceof Function) {
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
getCLS(onPerfEntry);