[{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7053",
"severity": 8,
"message": "Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ ru: { nav: string[]; hero: { new: string; title: string; titleHighlight: string; subtitle: string; cta: string; }; features: { title: string; list: { title: string; description: string; }[]; }; pricing: { title: string; services: string[]; regions: string[]; perMonth: string; buy: string; }; social: { ...; }; foot...'.\n No index signature with a parameter of type 'string' was found on type '{ ru: { nav: string[]; hero: { new: string; title: string; titleHighlight: string; subtitle: string; cta: string; }; features: { title: string; list: { title: string; description: string; }[]; }; pricing: { title: string; services: string[]; regions: string[]; perMonth: string; buy: string; }; social: { ...; }; foot...'.",
"source": "ts",
"startLineNumber": 131,
"startColumn": 58,
"endLineNumber": 131,
"endColumn": 73
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7053",
"severity": 8,
"message": "Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ ru: { nav: string[]; hero: { new: string; title: string; titleHighlight: string; subtitle: string; cta: string; }; features: { title: string; list: { title: string; description: string; }[]; }; pricing: { title: string; services: string[]; regions: string[]; perMonth: string; buy: string; }; social: { ...; }; foot...'.\n No index signature with a parameter of type 'string' was found on type '{ ru: { nav: string[]; hero: { new: string; title: string; titleHighlight: string; subtitle: string; cta: string; }; features: { title: string; list: { title: string; description: string; }[]; }; pricing: { title: string; services: string[]; regions: string[]; perMonth: string; buy: string; }; social: { ...; }; foot...'.",
"source": "ts",
"startLineNumber": 132,
"startColumn": 56,
"endLineNumber": 132,
"endColumn": 71
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7053",
"severity": 8,
"message": "Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ ru: { nav: string[]; hero: { new: string; title: string; titleHighlight: string; subtitle: string; cta: string; }; features: { title: string; list: { title: string; description: string; }[]; }; pricing: { title: string; services: string[]; regions: string[]; perMonth: string; buy: string; }; social: { ...; }; foot...'.\n No index signature with a parameter of type 'string' was found on type '{ ru: { nav: string[]; hero: { new: string; title: string; titleHighlight: string; subtitle: string; cta: string; }; features: { title: string; list: { title: string; description: string; }[]; }; pricing: { title: string; services: string[]; regions: string[]; perMonth: string; buy: string; }; social: { ...; }; foot...'.",
"source": "ts",
"startLineNumber": 133,
"startColumn": 13,
"endLineNumber": 133,
"endColumn": 28
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'item' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 169,
"startColumn": 27,
"endLineNumber": 169,
"endColumn": 31
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'index' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 169,
"startColumn": 33,
"endLineNumber": 169,
"endColumn": 38
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'feature' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 218,
"startColumn": 33,
"endLineNumber": 218,
"endColumn": 40
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'index' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 218,
"startColumn": 42,
"endLineNumber": 218,
"endColumn": 47
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'service' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 240,
"startColumn": 38,
"endLineNumber": 240,
"endColumn": 45
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'region' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 251,
"startColumn": 37,
"endLineNumber": 251,
"endColumn": 43
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'social' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 310,
"startColumn": 36,
"endLineNumber": 310,
"endColumn": 42
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'link' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 327,
"startColumn": 42,
"endLineNumber": 327,
"endColumn": 46
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'index' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 327,
"startColumn": 48,
"endLineNumber": 327,
"endColumn": 53
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'link' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 335,
"startColumn": 43,
"endLineNumber": 335,
"endColumn": 47
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'index' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 335,
"startColumn": 49,
"endLineNumber": 335,
"endColumn": 54
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'link' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 343,
"startColumn": 44,
"endLineNumber": 343,
"endColumn": 48
},{
"resource": "/D:/netpclanding/landing/components/landing-page.tsx",
"owner": "typescript",
"code": "7006",
"severity": 8,
"message": "Parameter 'index' implicitly has an 'any' type.",
"source": "ts",
"startLineNumber": 343,
"startColumn": 50,
"endLineNumber": 343,
"endColumn": 55
}]
To fix the TypeScript errors in your landing-page.tsx file, you'll need to add type annotations to your variables and function parameters. Here's how you can resolve each error:
-
Define a Lang type and use it for the lang state:
type Lang = 'ru' | 'en';
// ...
const [lang, setLang] = useState<Lang>('ru');
This tells TypeScript that lang can only be 'ru' or 'en', which helps when indexing into the languages object.
-
Ensure the languages object is typed correctly:
Add as const to your languages object to let TypeScript know that it's a constant and its structure won't change:
const languages = {
ru: { /* ... */ },
en: { /* ... */ }
} as const;
This allows TypeScript to infer the types of languages[lang] correctly.
-
Add type annotations to function parameters:
Whenever you use functions like map, filter, etc., make sure to specify the types of the parameters. For example:
-
For the navigation items:
{t.nav.map((item: string, index: number) => (
/* ... */
))}
-
For the features list:
First, define a Feature interface:
interface Feature {
title: string;
description: string;
}
Then, use it:
{t.features.list.map((feature: Feature, index: number) => (
/* ... */
))}
-
For services and regions:
{t.pricing.services.map((service: string) => (
/* ... */
))}
{t.pricing.regions.map((region: string) => (
/* ... */
))}
-
For social buttons:
{t.social.buttons.map((social: string) => (
/* ... */
))}
-
For footer links:
{t.footer.mainLinks.map((link: string, index: number) => (
/* ... */
))}
{t.footer.legalLinks.map((link: string, index: number) => (
/* ... */
))}
{t.footer.socialLinks.map((link: string, index: number) => (
/* ... */
))}
-
Update the plans array if necessary:
If you encounter any errors with the plans array, you can define a Plan interface and type the array:
interface Plan {
name: string;
cpu: string;
ram: string;
storage: string;
price: string;
}
const plans: Plan[] = [
{ /* ... */ },
{ /* ... */ }
];
By making these changes, you should resolve all the TypeScript errors in your file. Here's the updated code with the fixes applied:
'use client'
import React, { useState } from 'react'
import { Button } from "@/components/ui/button"
import { Card, CardContent } from "@/components/ui/card"
import { ServerIcon, ShieldCheckIcon, BoltIcon, HeadphonesIcon, RocketIcon, CogIcon } from 'lucide-react'
type Lang = 'ru' | 'en';
interface Feature {
title: string;
description: string;
}
interface Plan {
name: string;
cpu: string;
ram: string;
storage: string;
price: string;
}
const languages = {
ru: {
nav: ['Главная', 'Новости', 'Поддержка', 'Статус серверов'],
hero: {
new: 'Запустили продажу VDS в Германии!',
title: 'Идеальный хостинг для',
titleHighlight: 'вашего проекта',
subtitle: 'Воплощайте свои фантазии в реальность, и покоряйте вершины вместе с нами',
cta: 'Перейти к услугам'
},
features: {
title: 'Почему мы?',
list: [
{
title: 'Быстрые серверы',
description: 'Мы используем самые современные процессоры высокой частоты, которые гарантируют максимальную производительность вашего сервера.'
},
{
title: 'Защита от DDoS',
description: 'Все серверы имеют сеть с низкой задержкой и каналом в 1 Гбит/с. На платных тарифах стоит мощная защита от DDoS-атак.'
},
{
title: 'Надёжные дата-центры',
description: 'Серверы размещены в центрах обработки данных "InterXion", "ММТС-9" которые соответствуют самым высоким стандартам с полной физической и аппаратной защитой.'
},
{
title: 'Оперативная поддержка',
description: 'Наша поддержка готова помочь вам в любое время суток и проконсультировать вас по любому вопросу. Работаем 24/7.'
},
{
title: 'Минимальный пинг',
description: 'Наши узлы расположены в Германии и Москве, что способствует низкому пингу и задержке во время игры.'
},
{
title: 'Поддержка модов',
description: 'Мы поддерживаем как плагины, так и моды. Их число не ограничено. Вы сможете реализовать ваши самые интересные мысли!'
}
]
},
pricing: {
title: 'Наши услуги',
services: ['Игровые услуги', 'VDS-серверы', 'DDoS-защита'],
regions: ['Германия', 'Россия'],
perMonth: 'в месяц',
buy: 'Приобрести'
},
social: {
title: 'Возникли вопросы? Нужна помощь?',
subtitle: 'Обратитесь в поддержку через любой удобный сервис',
buttons: ['вконтакте', 'telegram', 'discord']
},
footer: {
main: 'Главное',
mainLinks: ['Главная страница', 'Услуги', 'Новости', 'Поддержка', 'Панель управления'],
legal: 'Юр. Информация',
legalLinks: ['Условия использования', 'Политика конфиденциальности'],
social: 'Социальные сети',
socialLinks: ['ВКонтакте', 'Telegram', 'Discord']
}
},
en: {
nav: ['Home', 'News', 'Support', 'Server Status'],
hero: {
new: 'VDS sales launched in Germany!',
title: 'Perfect hosting for',
titleHighlight: 'your project',
subtitle: 'Bring your fantasies to life and conquer new heights with us',
cta: 'View Services'
},
features: {
title: 'Why Choose Us?',
list: [
{
title: 'Fast Servers',
description: 'We use the most modern high-frequency processors that guarantee maximum performance for your server.'
},
{
title: 'DDoS Protection',
description: 'All servers have a low-latency network with a 1 Gbps channel. Paid plans include powerful DDoS attack protection.'
},
{
title: 'Reliable Data Centers',
description: 'Servers are located in "InterXion" and "MMTS-9" data centers that meet the highest standards with full physical and hardware protection.'
},
{
title: 'Prompt Support',
description: 'Our support is ready to help you at any time and consult you on any issue. We work 24/7.'
},
{
title: 'Minimal Ping',
description: 'Our nodes are located in Germany and Moscow, which contributes to low ping and latency during gameplay.'
},
{
title: 'Mod Support',
description: 'We support both plugins and mods. Their number is unlimited. You can implement your most interesting ideas!'
}
]
},
pricing: {
title: 'Our Services',
services: ['Game Services', 'VDS Servers', 'DDoS Protection'],
regions: ['Germany', 'Russia'],
perMonth: 'per month',
buy: 'Purchase'
},
social: {
title: 'Questions? Need help?',
subtitle: 'Contact support through any convenient service',
buttons: ['vkontakte', 'telegram', 'discord']
},
footer: {
main: 'Main',
mainLinks: ['Home Page', 'Services', 'News', 'Support', 'Control Panel'],
legal: 'Legal Information',
legalLinks: ['Terms of Use', 'Privacy Policy'],
social: 'Social Media',
socialLinks: ['VKontakte', 'Telegram', 'Discord']
}
}
} as const
export function LandingPageComponent() {
const [lang, setLang] = useState<Lang>('ru')
const [selectedService, setSelectedService] = useState(languages[lang].pricing.services[0])
const [selectedRegion, setSelectedRegion] = useState(languages[lang].pricing.regions[0])
const t = languages[lang]
const plans: Plan[] = [
{
name: lang === 'ru' ? 'Бесплатный сервер' : 'Free Server',
cpu: '125%',
ram: '2GB DDR4',
storage: '10GB NVMe',
price: '0'
},
{
name: 'Eternal (промо)',
cpu: '150%',
ram: '3GB DDR4',
storage: '32GB NVMe',
price: '49'
}
]
const toggleLanguage = () => {
setLang(lang === 'ru' ? 'en' : 'ru')
}
return (
<div className="min-h-screen bg-black text-white">
{/* Navbar */}
<nav className="border-b border-white/10">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex justify-between h-16 items-center">
<div className="flex items-center">
<a href="#" className="text-2xl font-bold flex items-center">
<img src="/placeholder.svg?height=32&width=32" alt="Aurorix Logo" className="h-8 w-8 mr-2" />
Aurorix
</a>
</div>
<div className="hidden md:flex items-center space-x-8">
{t.nav.map((item: string, index: number) => (
<a key={index} href="#" className="text-gray-300 hover:text-white transition-colors">{item}</a>
))}
</div>
<div className="flex items-center space-x-4">
<Button variant="ghost" size="icon" onClick={toggleLanguage}>
{lang === 'ru' ? '🇷🇺' : '🇬🇧'}
</Button>
<Button variant="default">
{lang === 'ru' ? 'Личный кабинет' : 'Personal Account'}
</Button>
</div>
</div>
</div>
</nav>
{/* Hero Section */}
{/* ... (rest of the code remains the same) ... */}
{/* Features Grid */}
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-24">
<h2 className="text-3xl font-bold mb-12 flex items-center justify-center">
{t.features.title}
<span className="ml-2">✨</span>
</h2>
<div className="grid md:grid-cols-3 gap-8">
{t.features.list.map((feature: Feature, index: number) => (
<Card key={index} className="bg-gradient-to-br from-gray-900 to-black border-purple-500/10 hover:border-purple-500/30 transition-all duration-300">
<CardContent className="p-6">
<div className="w-12 h-12 bg-purple-500/20 rounded-lg flex items-center justify-center mb-4">
{[BoltIcon, ShieldCheckIcon, ServerIcon, HeadphonesIcon, RocketIcon, CogIcon][index]({ className: "w-6 h-6 text-purple-400" })}
</div>
<h3 className="text-xl font-semibold mb-2">{feature.title}</h3>
<p className="text-gray-400">{feature.description}</p>
</CardContent>
</Card>
))}
</div>
</div>
{/* Pricing Section */}
{/* ... (rest of the code remains the same) ... */}
{/* Social Links Banner */}
{/* ... (rest of the code remains the same) ... */}
{/* Footer */}
<footer className="bg-black border-t border-white/10">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
<div className="grid grid-cols-2 md:grid-cols-3 gap-8">
<div>
<h3 className="text-lg font-semibold mb-4">{t.footer.main}</h3>
<ul className="space-y-2">
{t.footer.mainLinks.map((link: string, index: number) => (
<li key={index}><a href="#" className="text-gray-400 hover:text-white transition-colors">{link}</a></li>
))}
</ul>
</div>
<div>
<h3 className="text-lg font-semibold mb-4">{t.footer.legal}</h3>
<ul className="space-y-2">
{t.footer.legalLinks.map((link: string, index: number) => (
<li key={index}><a href="#" className="text-gray-400 hover:text-white transition-colors">{link}</a></li>
))}
</ul>
</div>
<div>
<h3 className="text-lg font-semibold mb-4">{t.footer.social}</h3>
<ul className="space-y-2">
{t.footer.socialLinks.map((link: string, index: number) => (
<li key={index}><a href="#" className="text-gray-400 hover:text-white transition-colors">{link}</a></li>
))}
</ul>
</div>
</div>
</div>
</footer>
</div>
)
}
After applying these changes, the TypeScript errors should be resolved. Remember to always provide explicit types for your variables and function parameters to help TypeScript catch potential issues and provide better code assistance.