Skip to content

Commit 531aa0e

Browse files
committed
Fix types
1 parent 16dcae4 commit 531aa0e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/components/SetRepository.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function SetRepository(): ReactElement {
6868
useEffect(() => {
6969
const currentRepositoryStr =
7070
window.localStorage.getItem("currentRepository");
71-
let currentRepository: CurrentRepository;
71+
let currentRepository: CurrentRepository | null = null;
7272
if (currentRepositoryStr) {
7373
try {
7474
currentRepository = JSON.parse(currentRepositoryStr);
@@ -78,7 +78,7 @@ function SetRepository(): ReactElement {
7878
}
7979
setNewRepository({
8080
type: currentRepository?.type || CurrentRepositoryType.User,
81-
owner: currentRepository?.owner || viewerData?.login,
81+
owner: currentRepository?.owner || viewerData?.login || "",
8282
repository: currentRepository?.repository || "",
8383
});
8484
}, [viewerData?.login]);
@@ -116,7 +116,7 @@ function SetRepository(): ReactElement {
116116
[currentStep]
117117
);
118118

119-
const repositoriesPicker = useMemo<Array<string>>(() => {
119+
const repositoriesPicker = useMemo<Array<string> | undefined>(() => {
120120
if (!ownerData) return undefined;
121121
return ownerData.repositories.nodes.map(
122122
(repository: RepositoryNode) => repository.name
@@ -143,7 +143,8 @@ function SetRepository(): ReactElement {
143143
}
144144

145145
function handleGoToNextStep(): void {
146-
const nr: CurrentRepository = newRepository;
146+
const nr: CurrentRepository | undefined = newRepository;
147+
if (!nr) return;
147148
if (steps[currentStepIndex + 1].value === "repository") {
148149
nr[steps[currentStepIndex + 1].value] = "";
149150
getRepositories();

0 commit comments

Comments
 (0)