diff --git a/packages/tailwindest/CHANGELOG.md b/packages/tailwindest/CHANGELOG.md index 9aa852b..dc656cf 100644 --- a/packages/tailwindest/CHANGELOG.md +++ b/packages/tailwindest/CHANGELOG.md @@ -1,5 +1,11 @@ # tailwindest +## 2.3.4 + +### Patch Changes + +- Fix invalid typing at createTools.variants + ## 2.3.3 ### Patch Changes diff --git a/packages/tailwindest/__tests__/get.variants.test.ts b/packages/tailwindest/__tests__/get.variants.test.ts index 423fe84..81c825a 100644 --- a/packages/tailwindest/__tests__/get.variants.test.ts +++ b/packages/tailwindest/__tests__/get.variants.test.ts @@ -227,15 +227,9 @@ describe(label.unit("GetVariants - variants: with boolean | number"), () => { onlyTrue?: true onlyFalse?: false numbers?: 1 | 2 - never?: "Error: typeof variants key should be | | <'true' | 'false'>" - withNever?: - | "withNever" - | "Error: typeof variants key should be | | <'true' | 'false'>" - combinations?: - | 1 - | boolean - | "withNever" - | "Error: typeof variants key should be | | <'true' | 'false'>" + never?: never + withNever?: "withNever" + combinations?: 1 | boolean | "withNever" } > >(true) @@ -252,15 +246,9 @@ describe(label.unit("GetVariants - variants: with boolean | number"), () => { onlyTrue?: true onlyFalse?: false numbers?: 1 | 2 - never?: "Error: typeof variants key should be | | <'true' | 'false'>" - withNever?: - | "withNever" - | "Error: typeof variants key should be | | <'true' | 'false'>" - combinations?: - | 1 - | boolean - | "withNever" - | "Error: typeof variants key should be | | <'true' | 'false'>" + never?: never + withNever?: "withNever" + combinations?: 1 | boolean | "withNever" } > >(true) diff --git a/packages/tailwindest/package.json b/packages/tailwindest/package.json index 3a3ba75..3daf5aa 100644 --- a/packages/tailwindest/package.json +++ b/packages/tailwindest/package.json @@ -1,6 +1,6 @@ { "name": "tailwindest", - "version": "2.3.3", + "version": "2.3.4", "description": "typesafe, reusable tailwind", "homepage": "https://tailwindest.vercel.app", "author": "danpacho", diff --git a/packages/tailwindest/src/core/tools/create.rotary.ts b/packages/tailwindest/src/core/tools/create.rotary.ts index 9bf11db..8fc986d 100644 --- a/packages/tailwindest/src/core/tools/create.rotary.ts +++ b/packages/tailwindest/src/core/tools/create.rotary.ts @@ -7,11 +7,7 @@ import type { TailwindestStyler } from "./tool.interface" const createRotary = () => - < - VariantsStylesType extends { - [key in keyof VariantsStylesType]: StyleType - }, - >({ + ({ base, ...styles }: { [key in keyof VariantsStylesType]: StyleType } & { diff --git a/packages/tailwindest/src/create.tools.ts b/packages/tailwindest/src/create.tools.ts index 77b3860..27d8d59 100644 --- a/packages/tailwindest/src/create.tools.ts +++ b/packages/tailwindest/src/create.tools.ts @@ -106,11 +106,7 @@ const createTools = (): { * ) * ``` */ - rotary: < - VariantsStylesType extends { - [key in keyof VariantsStylesType]: StyleType - }, - >({ + rotary: ({ base, ...styles }: { [key in keyof VariantsStylesType]: StyleType } & { @@ -184,17 +180,16 @@ const createTools = (): { * ) * ``` */ - variants: < - Variants extends { - [VariantsKey in keyof Variants]: { - [key in keyof Variants[VariantsKey]]: StyleType - } - }, - >({ + variants: ({ base, variants, }: { - variants: Variants + variants: { + [VariantsKey in keyof Variants]: Record< + keyof Variants[VariantsKey], + StyleType + > + } } & { base?: StyleType }) => {