Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade TypeScript syntax #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function useInterval(callback: () => void, delay: number) {
// Set up the interval.
useEffect(() => {
function tick() {
savedCallback.current && savedCallback.current();
savedCallback.current?.();
}
if (delay !== null) {
let id = setInterval(tick, delay);
Expand Down
1 change: 0 additions & 1 deletion src/react-app-env.d.ts
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
/// <reference types="react-scripts" />
17 changes: 2 additions & 15 deletions src/serviceWorker.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
// This optional code is used to register a service worker.
// register() is not called by default.

// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.

// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA

const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
Expand Down Expand Up @@ -101,8 +89,7 @@ function registerValidSW(swUrl: string, config?: Config) {
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
.catch(error => {config?.onUpdateor during service worker registration:', error);
});
}

Expand All @@ -113,7 +100,7 @@ function checkValidServiceWorker(swUrl: string, config?: Config) {
})
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
consconfig?.onSuccesseaders.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
Expand Down
4 changes: 0 additions & 4 deletions src/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom/extend-expect';