Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix esm support and types #57

Merged
merged 1 commit into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions clsx.d.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
export type ClassDictionary = Record<string, any>;
export type ClassArray = ClassValue[];

export function clsx(...inputs: ClassValue[]): string;
export default clsx;
14 changes: 9 additions & 5 deletions clsx.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
export type ClassDictionary = Record<string, any>;
export type ClassArray = ClassValue[];
declare namespace clsx {
type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
type ClassDictionary = Record<string, any>;
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;
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down