From 83ad33ae285f09c7b125c340e77c20d380c9c6d6 Mon Sep 17 00:00:00 2001 From: paco <34928425+pacocoursey@users.noreply.github.com> Date: Tue, 12 Mar 2024 20:43:22 -0700 Subject: [PATCH] Improve data attributes typing using template literal types --- next-themes/src/types.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next-themes/src/types.ts b/next-themes/src/types.ts index e59822e..1024119 100644 --- a/next-themes/src/types.ts +++ b/next-themes/src/types.ts @@ -35,7 +35,7 @@ export interface ThemeProviderProps { /** Default theme name (for v0.0.12 and lower the default was light). If `enableSystem` is false, the default theme is light */ defaultTheme?: string | undefined /** HTML attribute modified based on the active theme. Accepts `class` and `data-*` (meaning any data attribute, `data-mode`, `data-color`, etc.) */ - attribute?: string | 'class' | undefined + attribute?: `data-${string}` | 'class' | undefined /** Mapping of theme name to HTML attribute value. Object where key is the theme name and value is the attribute value */ value?: ValueObject | undefined /** Nonce string to pass to the inline script for CSP headers */