nextui-org / tailwind-variants

🦄 Tailwindcss first-class variant API
https://tailwind-variants.org
MIT License
2.42k stars 70 forks source link

Wrong typing for `twMergeConfig` #54

Closed omarkhatibco closed 1 year ago

omarkhatibco commented 1 year ago

Describe the bug why passing twMergeConfig to tv function I get this error

Type 'Partial<Config>' is not assignable to type 'Config'.
  Types of property 'cacheSize' are incompatible.
    Type 'number | undefined' is not assignable to type 'number'.
      Type 'undefined' is not assignable to type 'number'.

the Problem is in tv typing where twMergeConfig is type of TwMergeConfig

import type {Config as TwMergeConfig} from "tailwind-merge";

export type TWMConfig = {
  twMergeConfig?: TwMergeConfig;
};

however, inside tailwind-merge the config type is

import { Config } from './types';
type CreateConfigSubsequent = (config: Config) => Config;
export declare function extendTailwindMerge(configExtension: Partial<Config> | CreateConfigSubsequent, ...createConfig: CreateConfigSubsequent[]): (...classLists: import("./tw-join").ClassNameValue[]) => string;

To Reproduce check vscode

Expected behavior twMergeConfig has to correct typing