Skip to content

Commit

Permalink
chore: extend tsconfig + handle new TS errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AloisSeckar committed Sep 26, 2023
1 parent 9f2939d commit b935617
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 193 deletions.
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
// https://v3.nuxtjs.org/concepts/typescript
"extends": "./.nuxt/tsconfig.json"
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"noUncheckedIndexedAccess": true
},
}
8 changes: 4 additions & 4 deletions utils/wbsc-eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ function changeBatterSpecificAction () {
if (isNaN(Number(posSelection[0]))) {
posItem1.value = posSelection
} else {
posItem1.value = posSelection[0]
posItem1.value = posSelection[0] || '1'
}
}

if (fc === true) {
const posItem2 = document.getElementById(groupID + '2') as HTMLInputElement
posItem2.innerHTML = renderFCLocationOptions().join(' ')
posItem2.value = useEvalStore().getPosSelection(groupID)[1]
posItem2.value = useEvalStore().getPosSelection(groupID)[1] || 'Z' // for "HP"
}

const runTypeSelect = document.getElementById(inputB + inputRuntype) as HTMLInputElement
Expand Down Expand Up @@ -320,7 +320,7 @@ function changeRunnerSpecificAction (group: string) {
if (throwing === true) {
const posItem2 = document.getElementById(groupID + '2') as HTMLInputElement
posItem2.innerHTML = renderFCLocationOptions().join(' ')
posItem2.value = useEvalStore().getPosSelection(groupID)[1]
posItem2.value = useEvalStore().getPosSelection(groupID)[1] || 'Z' // for HP
}

disableExtraInput(group, out === true)
Expand Down Expand Up @@ -692,7 +692,7 @@ function processInput (input: WBSCInput, batter: number): WBSCOutput {
let notAddedYet = true
const concurrentPlays = useEvalStore().concurrentPlays
for (let i = 0; i < concurrentPlays.length; i += 1) {
if (concurrentPlays[i].batter === batter) {
if (concurrentPlays[i]?.batter === batter) {
notAddedYet = false
break
}
Expand Down
2 changes: 1 addition & 1 deletion utils/wbsc-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ function getPosSelectionSelect (group: string, ord: number) {
const posSelection = useEvalStore().getPosSelection(groupID)
posItem.innerHTML = renderPlayerOptions().join(' ')
if (posSelection.length > ord - 1) {
posItem.value = posSelection[ord - 1]
posItem.value = posSelection[ord - 1] || '1'
}

posItem.addEventListener('change', function () {
Expand Down
2 changes: 1 addition & 1 deletion utils/wbsc-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function setInputs (input: WBSCInput) {
posSelection.innerHTML = renderFCLocationOptions().join(' ') // default are player positions
}
}
posSelection.value = pos[i]
posSelection.value = pos[i] || '1'
}
} else {
const hitSelection = document.getElementById(group + inputPosition + '1') as HTMLSelectElement
Expand Down
Loading

0 comments on commit b935617

Please # to comment.