Skip to content

Commit 82d60be

Browse files
fix(join): satisfy eslint for Telegram widget callback
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 4f434c1 commit 82d60be

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎src/layouts/Join.tsx‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@ type TelegramWidgetUser = {
3030
hash: string;
3131
};
3232

33-
declare global {
34-
interface Window {
35-
onFrontChapterTelegramAuth?: (user: TelegramWidgetUser) => void;
36-
}
37-
}
33+
type TelegramAuthWindow = Window & {
34+
onFrontChapterTelegramAuth?: (user: TelegramWidgetUser) => void;
35+
};
3836

3937
const TELEGRAM_BOT_USERNAME =
4038
process.env.NEXT_PUBLIC_TELEGRAM_BOT_USERNAME || 'FrontChapterMagic';
@@ -183,7 +181,8 @@ const Join = () => {
183181
const host = widgetRef.current;
184182
if (!host) return;
185183

186-
window.onFrontChapterTelegramAuth = (user) => {
184+
const w = window as TelegramAuthWindow;
185+
w.onFrontChapterTelegramAuth = (user) => {
187186
void finishTelegramLogin(user);
188187
};
189188

@@ -199,7 +198,7 @@ const Join = () => {
199198
host.appendChild(script);
200199

201200
return () => {
202-
delete window.onFrontChapterTelegramAuth;
201+
delete w.onFrontChapterTelegramAuth;
203202
host.innerHTML = '';
204203
};
205204
}, [step, finishTelegramLogin]);

0 commit comments

Comments
 (0)