From cb181e183fe34bc637b59fe3f52c7a9dfff4dee2 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Thu, 24 Nov 2022 13:13:57 +0900 Subject: [PATCH] Prefer `as const` with TypeScript 4.9 introduced `satisfies` operator https://github.com/microsoft/TypeScript/issues/47920 https://devblogs.microsoft.com/typescript/announcing-typescript-4-9-rc/#satisfies This is my hope since https://github.com/mobu-of-the-world/mobu/pull/479#discussion_r907975380 --- src/session/Timer.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/session/Timer.tsx b/src/session/Timer.tsx index a7d39b77..2d8c14b6 100644 --- a/src/session/Timer.tsx +++ b/src/session/Timer.tsx @@ -89,14 +89,12 @@ const Timer = ({ setIterationCount(1); if (Notification.permission !== "granted") { - const alertMessageByNotificationPermission: Readonly< - { - [key in NotificationPermission]: string; - } - > = { + const alertMessageByNotificationPermission = { granted: "Thanks to accept the notification :)", denied: "You rejected the notification :(Please accept it.", default: "Can not judge to use notification :(Please accept it.", + } as const satisfies { + [key in NotificationPermission]: string; }; void Notification.requestPermission((result) => {