diff --git a/clsx.d.mts b/clsx.d.mts new file mode 100644 index 0000000..2220c93 --- /dev/null +++ b/clsx.d.mts @@ -0,0 +1,6 @@ +export type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined; +export type ClassDictionary = Record; +export type ClassArray = ClassValue[]; + +export function clsx(...inputs: ClassValue[]): string; +export default clsx; diff --git a/clsx.d.ts b/clsx.d.ts index f557360..b86650a 100644 --- a/clsx.d.ts +++ b/clsx.d.ts @@ -1,6 +1,10 @@ -export type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined; -export type ClassDictionary = Record; -export type ClassArray = ClassValue[]; +declare namespace clsx { + type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined; + type ClassDictionary = Record; + type ClassArray = ClassValue[]; + function clsx(...inputs: ClassValue[]): string; +} -export declare function clsx(...inputs: ClassValue[]): string; -export default clsx; +declare function clsx(...inputs: clsx.ClassValue[]): string; + +export = clsx; diff --git a/package.json b/package.json index 8f2f743..bf411e9 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,19 @@ "version": "1.2.1", "repository": "lukeed/clsx", "description": "A tiny (228B) utility for constructing className strings conditionally.", - "module": "dist/clsx.m.js", + "module": "dist/clsx.mjs", "unpkg": "dist/clsx.min.js", "main": "dist/clsx.js", + "exports": { + "import": { + "types": "./clsx.d.mts", + "default": "./dist/clsx.mjs" + }, + "default": { + "types": "./clsx.d.ts", + "default": "./dist/clsx.js" + } + }, "types": "clsx.d.ts", "license": "MIT", "author": {