From 72ecc9eec301553605851ad66685deb0f946e5c5 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Mon, 5 Jan 2026 16:16:07 +0000 Subject: [PATCH] fix(typescript): improve type safety in string and geo-location modules Removes `@ts-expect-error` suppressions in `src/lib/string.ts` and `src/lib/geo-location.ts` and replaces them with appropriate type annotations and assertions. In `src/lib/string.ts`, the `capitalize` function's parameters are now explicitly typed as `string`. In `src/lib/geo-location.ts`, a type assertion is used to properly type the JSON response from the geo-location API. --- src/lib/geo-location.ts | 3 +-- src/lib/string.ts | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/lib/geo-location.ts b/src/lib/geo-location.ts index 49ff1878cb4..875925ec544 100644 --- a/src/lib/geo-location.ts +++ b/src/lib/geo-location.ts @@ -97,8 +97,7 @@ const getGeoLocationFromAPI = async (): Promise => { method: 'GET', signal: AbortSignal.timeout(REQUEST_TIMEOUT), }) - // @ts-expect-error TS(2339) - Property 'geo' does not exist on type 'unknown' - const { geo } = await res.json() + const { geo } = (await res.json()) as { geo: Geolocation } return geo } diff --git a/src/lib/string.ts b/src/lib/string.ts index 9504733a69c..13844dcb2c0 100644 --- a/src/lib/string.ts +++ b/src/lib/string.ts @@ -1,5 +1,3 @@ -// @ts-expect-error TS(7006) FIXME: Parameter 't' implicitly has an 'any' type. -export const capitalize = function (t) { - // @ts-expect-error TS(7006) FIXME: Parameter 'string' implicitly has an 'any' type. +export const capitalize = function (t: string) { return t.replace(/(^\w|\s\w)/g, (string) => string.toUpperCase()) }