Skip to content

Commit 3aace32

Browse files
committed
chore: noUncheckedIndexAccess
1 parent 15dbb36 commit 3aace32

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/dev/devtools.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ export function routes(
160160
}
161161

162162
try {
163-
initialData = (await getInitialData(frameUrl)) as Bootstrap['data']
163+
if (frameUrl)
164+
initialData = (await getInitialData(frameUrl)) as Bootstrap['data']
164165
} catch (error) {
165166
if (error instanceof HTTPException) throw error
166167
}

src/utils/getImagePaths.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function getImagePaths(path: string) {
44

55
// skip the first split result as it's empty
66
for (let i = 1; i < pathParts.length; i++) {
7-
if (!pathParts[i].startsWith(':') || !pathParts[i].endsWith('?')) continue
7+
if (!pathParts[i]?.startsWith(':') || !pathParts[i]?.endsWith('?')) continue
88
imagePaths.push(`${pathParts.slice(0, i).join('/')}/image`)
99
}
1010
imagePaths.push(`${path}/image`)

src/utils/parsePath.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export function parsePath(path_: string) {
2-
let path = path_.split('?')[0]
1+
export function parsePath(path_: string): string {
2+
let path = path_.split('?')[0]!
33
if (path.endsWith('/')) path = path.slice(0, -1)
44
return path
55
}

tsconfig.base.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"useDefineForClassFields": true, // Not enabled by default in `strict` mode unless we bump `target` to ES2022.
1212
"noFallthroughCasesInSwitch": true, // Not enabled by default in `strict` mode.
1313
"noImplicitReturns": true, // Not enabled by default in `strict` mode.
14+
"noUncheckedIndexedAccess": true,
1415
"useUnknownInCatchVariables": true, // TODO: This would normally be enabled in `strict` mode but would require some adjustments to the codebase.
1516
"noImplicitOverride": true, // Not enabled by default in `strict` mode.
1617
"noUnusedLocals": true, // Not enabled by default in `strict` mode.

0 commit comments

Comments
 (0)