Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Fix typescript complaints

Blue Mouse2ead2d385795
diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.ts
index 0939e8cb0..03cd5e78f 100644
--- a/web/app/lib/constants/index.ts
+++ b/web/app/lib/constants/index.ts
@@ -253,7 +253,7 @@ export const tbsFormatMapper = {
day: '%d %b',
month: '%b %Y',
year: '%Y',
-}
+} as Record<string, string>
export const tbsFormatMapperTooltip = {
minute: '%I:%M %p',
@@ -261,7 +261,7 @@ export const tbsFormatMapperTooltip = {
day: '%d %b',
month: '%b %Y',
year: '%Y',
-}
+} as Record<string, string>
export const tbsFormatMapperTooltip24h = {
minute: '%H:%M',
@@ -269,7 +269,7 @@ export const tbsFormatMapperTooltip24h = {
day: '%d %b',
month: '%b %Y',
year: '%Y',
-}
+} as Record<string, string>
export const tbsFormatMapper24h = {
minute: '%H:%M',
@@ -277,12 +277,12 @@ export const tbsFormatMapper24h = {
day: '%d %b',
month: '%b %Y',
year: '%Y',
-}
+} as Record<string, string>
export const TimeFormat = {
'12-hour': '12-hour',
'24-hour': '24-hour',
-}
+} as const
export const PADDLE_JS_URL = 'https://cdn.paddle.com/paddle/paddle.js'
export const PADDLE_VENDOR_ID = 139393
@@ -405,7 +405,7 @@ export const whitelistWithCC = {
pl: 'pl-PL',
de: 'de-DE',
fr: 'fr-FR',
-}
+} as Record<string, string>
export const defaultLanguage = 'en'
export const languages = {
en: 'English',
@@ -413,7 +413,7 @@ export const languages = {
pl: 'Polski',
de: 'Deutsch',
fr: 'Français',
-}
+} as Record<string, string>
export const languageFlag = {
en: 'GB',
@@ -421,11 +421,11 @@ export const languageFlag = {
pl: 'PL',
fr: 'FR',
de: 'DE',
-}
+} as Record<string, string>
export const paddleLanguageMapping = {
uk: 'en',
-}
+} as Record<string, string>
// Increase this counter every time some major change is done within localisation files
// This will prevent cached version or raw locale strings being displayed in production
diff --git a/web/app/lib/models/User.ts b/web/app/lib/models/User.ts
index 99082be30..6e34158e2 100644
--- a/web/app/lib/models/User.ts
+++ b/web/app/lib/models/User.ts
@@ -58,7 +58,7 @@ export interface User {
discordWebhookUrl: string | null
telegramChatId: string | null
isTelegramChatIdConfirmed: boolean
- timeFormat: string
+ timeFormat: '12-hour' | '24-hour'
sharedProjects: SharedProject[]
registeredWithGoogle: boolean
googleId: string | null
diff --git a/web/app/pages/Captcha/View/ViewCaptcha.tsx b/web/app/pages/Captcha/View/ViewCaptcha.tsx
index 786ab744b..2765db432 100644
--- a/web/app/pages/Captcha/View/ViewCaptcha.tsx
+++ b/web/app/pages/Captcha/View/ViewCaptcha.tsx
@@ -114,7 +114,7 @@ const ViewCaptcha = () => {
const [searchParams] = useSearchParams()
- const timeFormat = useMemo(() => user?.timeFormat || TimeFormat['12-hour'], [user])
+ const timeFormat = useMemo<'12-hour' | '24-hour'>(() => user?.timeFormat || TimeFormat['12-hour'], [user])
const [ref, size] = useSize() as any
const rotateXAxias = useMemo(() => size.width > 0 && size.width < 500, [size])
const [chartType, setChartType] = useState(getItem('chartType') || chartTypes.line)