Telegram Group & Telegram Channel
🖥 Что делает конструкция [K in Status]: \[${K}]``?

Вот код из видео, который вызывает вопросы:


type Status = 'success' | 'error' | 'loading';

type StatusWithBrackets = {
[K in Status]: `[${K}]`
}[Status];


💡 Что здесь происходит?

1️⃣ **[K in Status]: \[${K}]`** Мы создаем объект на уровне типов. Для каждого значения из Status ('success' | 'error' | 'loading'`) генерируются ключи и их значения. Например:

{
success: "[success]",
error: "[error]",
loading: "[loading]"
}


2️⃣ [Status]
Эта часть "вытаскивает" все значения, которые соответствуют ключам Status.
То есть:

"[success]" | "[error]" | "[loading]"


🛠️ Итог: StatusWithBrackets превращается в объединение строк:
"[success]" | "[error]" | "[loading]".


#typescript
Please open Telegram to view this post
VIEW IN TELEGRAM



group-telegram.com/reactify_IT/1376
Create:
Last Update:

🖥 Что делает конструкция [K in Status]: \[${K}]``?

Вот код из видео, который вызывает вопросы:


type Status = 'success' | 'error' | 'loading';

type StatusWithBrackets = {
[K in Status]: `[${K}]`
}[Status];


💡 Что здесь происходит?

1️⃣ **[K in Status]: \[${K}]`** Мы создаем объект на уровне типов. Для каждого значения из Status ('success' | 'error' | 'loading'`) генерируются ключи и их значения. Например:

{
success: "[success]",
error: "[error]",
loading: "[loading]"
}


2️⃣ [Status]
Эта часть "вытаскивает" все значения, которые соответствуют ключам Status.
То есть:

"[success]" | "[error]" | "[loading]"


🛠️ Итог: StatusWithBrackets превращается в объединение строк:
"[success]" | "[error]" | "[loading]".


#typescript

BY Reactify | Frontend Разработка


Warning: Undefined variable $i in /var/www/group-telegram/post.php on line 260

Share with your friend now:
group-telegram.com/reactify_IT/1376

View MORE
Open in Telegram


Telegram | DID YOU KNOW?

Date: |

If you initiate a Secret Chat, however, then these communications are end-to-end encrypted and are tied to the device you are using. That means it’s less convenient to access them across multiple platforms, but you are at far less risk of snooping. Back in the day, Secret Chats received some praise from the EFF, but the fact that its standard system isn’t as secure earned it some criticism. If you’re looking for something that is considered more reliable by privacy advocates, then Signal is the EFF’s preferred platform, although that too is not without some caveats. Telegram has gained a reputation as the “secure” communications app in the post-Soviet states, but whenever you make choices about your digital security, it’s important to start by asking yourself, “What exactly am I securing? And who am I securing it from?” These questions should inform your decisions about whether you are using the right tool or platform for your digital security needs. Telegram is certainly not the most secure messaging app on the market right now. Its security model requires users to place a great deal of trust in Telegram’s ability to protect user data. For some users, this may be good enough for now. For others, it may be wiser to move to a different platform for certain kinds of high-risk communications. Multiple pro-Kremlin media figures circulated the post's false claims, including prominent Russian journalist Vladimir Soloviev and the state-controlled Russian outlet RT, according to the DFR Lab's report. Artem Kliuchnikov and his family fled Ukraine just days before the Russian invasion. What distinguishes the app from competitors is its use of what's known as channels: Public or private feeds of photos and videos that can be set up by one person or an organization. The channels have become popular with on-the-ground journalists, aid workers and Ukrainian President Volodymyr Zelenskyy, who broadcasts on a Telegram channel. The channels can be followed by an unlimited number of people. Unlike Facebook, Twitter and other popular social networks, there is no advertising on Telegram and the flow of information is not driven by an algorithm.
from us


Telegram Reactify | Frontend Разработка
FROM American