Skip to content

Commit 970d4cb

Browse files
committed
fix: resolve strict mode errors in renderer process
1 parent 8c217ea commit 970d4cb

File tree

77 files changed

+296
-242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+296
-242
lines changed

src/renderer/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import './App.css';
2626

2727
import { useAppContext } from './hooks/useAppContext';
2828

29-
function RequireAuth({ children }) {
29+
function RequireAuth({ children }: { children: React.ReactNode }) {
3030
const location = useLocation();
3131

3232
const { isLoggedIn } = useAppContext();

src/renderer/__mocks__/notifications-mocks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export const mockGitHubCloudGitifyNotifications: GitifyNotification[] = [
114114
latestCommentUrl:
115115
'https://api.github.com/repos/gitify-app/notifications-test/issues/comments/302885965' as Link,
116116
type: 'Issue',
117-
reviews: null,
117+
reviews: undefined,
118118
},
119119
repository: mockGitHubRepository,
120120
display: {
@@ -168,7 +168,7 @@ export const mockGithubEnterpriseGitifyNotifications: GitifyNotification[] = [
168168
latestCommentUrl:
169169
'https://github.gitify.io/api/v3/repos/myorg/notifications-test/releases/3' as Link,
170170
type: 'Release',
171-
reviews: null,
171+
reviews: undefined,
172172
},
173173
repository: mockEnterpriseRepository,
174174
display: {
@@ -199,7 +199,7 @@ export const mockGithubEnterpriseGitifyNotifications: GitifyNotification[] = [
199199
latestCommentUrl:
200200
'https://github.gitify.io/api/v3/repos/myorg/notifications-test/issues/comments/21' as Link,
201201
type: 'PullRequest',
202-
reviews: null,
202+
reviews: undefined,
203203
},
204204
repository: mockEnterpriseRepository,
205205
display: {

src/renderer/components/AllRead.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('renderer/components/AllRead.tsx', () => {
1717
});
1818
});
1919

20-
expect(tree.container).toMatchSnapshot();
20+
expect(tree!.container).toMatchSnapshot();
2121
});
2222

2323
it('should render itself & its children - with filters', async () => {
@@ -34,6 +34,6 @@ describe('renderer/components/AllRead.tsx', () => {
3434
});
3535
});
3636

37-
expect(tree.container).toMatchSnapshot();
37+
expect(tree!.container).toMatchSnapshot();
3838
});
3939
});

src/renderer/components/Oops.test.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { PersonIcon } from '@primer/octicons-react';
55

66
import { navigateMock, renderWithProviders } from '../__helpers__/test-utils';
77

8+
import type { GitifyError } from '../types';
9+
810
import { Oops } from './Oops';
911

1012
describe('renderer/components/Oops.tsx', () => {
@@ -21,17 +23,19 @@ describe('renderer/components/Oops.tsx', () => {
2123
tree = renderWithProviders(<Oops error={mockError} />);
2224
});
2325

24-
expect(tree.container).toMatchSnapshot();
26+
expect(tree!.container).toMatchSnapshot();
2527
});
2628

2729
it('should render itself & its children - fallback to unknown error', async () => {
2830
let tree: ReturnType<typeof renderWithProviders> | null = null;
2931

3032
await act(async () => {
31-
tree = renderWithProviders(<Oops error={null} />);
33+
tree = renderWithProviders(
34+
<Oops error={null as unknown as GitifyError} />,
35+
);
3236
});
3337

34-
expect(tree.container).toMatchSnapshot();
38+
expect(tree!.container).toMatchSnapshot();
3539
});
3640

3741
it('should render action buttons and navigate on click', async () => {

src/renderer/components/avatars/AvatarWithFallback.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ describe('renderer/components/avatars/AvatarWithFallback.tsx', () => {
3232

3333
it('renders the fallback icon when no src url - human user', () => {
3434
const tree = renderWithProviders(
35-
<AvatarWithFallback {...props} src={null} />,
35+
<AvatarWithFallback {...props} src={undefined} />,
3636
);
3737

3838
expect(tree.container).toMatchSnapshot();
3939
});
4040

4141
it('renders the fallback icon when no src url - non human user', () => {
4242
const tree = renderWithProviders(
43-
<AvatarWithFallback {...props} src={null} userType="Bot" />,
43+
<AvatarWithFallback {...props} src={undefined} userType="Bot" />,
4444
);
4545

4646
expect(tree.container).toMatchSnapshot();

src/renderer/components/layout/Centered.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const Centered: FC<CenteredProps> = (props: CenteredProps) => {
1111
return (
1212
<Stack
1313
align="center"
14-
className={props.fullHeight && 'h-screen'}
14+
className={props.fullHeight ? 'h-screen' : undefined}
1515
direction="vertical"
1616
justify="center"
1717
padding="spacious"

src/renderer/components/layout/EmojiSplash.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('renderer/components/layout/EmojiSplash.tsx', () => {
1616
});
1717
});
1818

19-
expect(tree.container).toMatchSnapshot();
19+
expect(tree!.container).toMatchSnapshot();
2020
});
2121

2222
it('should render itself & its children - heading and sub-heading', async () => {
@@ -34,6 +34,6 @@ describe('renderer/components/layout/EmojiSplash.tsx', () => {
3434
});
3535
});
3636

37-
expect(tree.container).toMatchSnapshot();
37+
expect(tree!.container).toMatchSnapshot();
3838
});
3939
});

src/renderer/components/layout/EmojiSplash.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ interface EmojiSplashProps {
1616

1717
export const EmojiSplash: FC<EmojiSplashProps> = (props: EmojiSplashProps) => {
1818
return (
19-
<Centered fullHeight={props.fullHeight}>
19+
<Centered fullHeight={props.fullHeight ?? false}>
2020
<Stack
2121
align="center"
2222
direction="vertical"

src/renderer/components/metrics/CommentsPill.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { CommentsPill, type CommentsPillProps } from './CommentsPill';
44

55
describe('renderer/components/metrics/CommentsPill.tsx', () => {
66
it('renders with no comments (null)', () => {
7-
const props: CommentsPillProps = null;
7+
const props = {} as CommentsPillProps;
88

99
const tree = renderWithProviders(<CommentsPill {...props} />);
1010

src/renderer/components/metrics/MetricGroup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const MetricGroup: FC<MetricGroupProps> = ({ notification }) => {
3737

3838
<CommentsPill commentCount={notification.subject.commentCount ?? 0} />
3939

40-
<MilestonePill milestone={notification.subject.milestone} />
40+
<MilestonePill milestone={notification.subject.milestone!} />
4141

4242
<LabelsPill labels={notification.subject.labels ?? []} />
4343
</div>

0 commit comments

Comments
 (0)