Skip to content

Commit 4b937da

Browse files
lwwmanningclaude
andauthored
Enable noUncheckedIndexedAccess; guard touch-event index access (#60)
Signed-off-by: Will Manning <will@willmanning.io> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6f0555a commit 4b937da

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/components/hero-404/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,10 @@ void main() {
218218
e.preventDefault();
219219
}
220220

221-
const touchX = e.touches[0].clientX;
222-
const touchY = e.touches[0].clientY;
221+
const touch = e.touches[0];
222+
if (!touch) return;
223+
const touchX = touch.clientX;
224+
const touchY = touch.clientY;
223225

224226
const x = (touchX / window.innerWidth) * 2 - 1;
225227
const y = (touchY / window.innerHeight) * 2 - 1;

src/components/hero/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ void main() {
227227
e.preventDefault();
228228
}
229229

230-
const touchX = e.touches[0].clientX;
231-
const touchY = e.touches[0].clientY;
230+
const touch = e.touches[0];
231+
if (!touch) return;
232+
const touchX = touch.clientX;
233+
const touchY = touch.clientY;
232234

233235
const x = (touchX / window.innerWidth) * 2 - 1;
234236
const y = (touchY / window.innerHeight) * 2 - 1;

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"moduleResolution": "bundler",
1414
"noUnusedLocals": true,
1515
"noUnusedParameters": true,
16+
"noUncheckedIndexedAccess": true,
1617
"resolveJsonModule": true,
1718
"isolatedModules": true,
1819
"jsx": "react-jsx",

0 commit comments

Comments
 (0)