# clsx: what changed from 1 to 2 - Product: clsx (https://whatsnew.fyi/product/clsx) - Vendor: Luke Edwards - Range: changelog entries numbered after v1.2.1 up to and including v2.1.1, stable releases only - Entries below: 4 releases (newest first) - Resolved: 1 is v1.2.1 and 2 is v2.1.1, the newest stable release of each major we track - Carrying security changes: 0 · CVEs mentioned: 0 · Mentioning breaking changes: 0 · Removing or deprecating something: 0 - Page: https://whatsnew.fyi/product/clsx/compare/1...2 What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: the summaries, labels and curation here are © What's New. Quote freely with attribution and a link back; wholesale republication of the corpus is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. ## What changed (5 changes, grouped by kind) ### Added #### v2.1.0 (2023-12-29) - Add new clsx/lite submodule for string-only usage, a 140b version ideal for Tailwind and React contexts that ignores all non-string arguments #### v2.0.0 (2023-07-16) - Add exports map for native ESM support with TypeScript node16 and nodenext module resolution ### Changed #### v2.0.1 (2023-12-29) - Cache arguments.length and array.length for improved performance #### v2.0.0 (2023-07-16) - Maintain CommonJS support with fixed TypeScript definitions ### Fixed #### v2.1.1 (2024-04-23) - Include `bigint` in `ClassValue` type to accommodate recent `@types/react` changes to `ReactNode` ## Release notes ### v2.1.1 - Date: 2024-04-23 - Version: v2.1.1 - Original notes: https://github.com/lukeed/clsx/releases/tag/v2.1.1 - Permalink: https://whatsnew.fyi/product/clsx/releases/v2.1.1 - **fixed** — Include `bigint` in `ClassValue` type to accommodate recent `@types/react` changes to `ReactNode` ##### Patches * (types) Include `bigint` in `ClassValue` type: (#96): 3d960ab _Accommodates recent `@types/react` changes to `ReactNode`._ _Thank you @ViliamKopecky~!_ ##### Chores - Add [`licenses.dev`](https://licenses.dev) badge: 684509c _This service recursively analyzes entire dependency graphs to ensure that a package (or your project) is using permissive licenses. For example, here's a results table for [`polka@next`](https://licenses.dev/npm/polka/1.0.0-next.24) and a larger [`astro`](https://licenses.dev/npm/astro) example._ --- > **Full Changelog**: https://github.com/lukeed/clsx/compare/v2.1.0...v2.1.1 ### v2.1.0 - Date: 2023-12-29 - Version: v2.1.0 - Original notes: https://github.com/lukeed/clsx/releases/tag/v2.1.0 - Permalink: https://whatsnew.fyi/product/clsx/releases/v2.1.0 - **added** — Add new clsx/lite submodule for string-only usage, a 140b version ideal for Tailwind and React contexts that ignores all non-string arguments ##### Features - Add new `clsx/lite` submodule for `string`-only usage: 1a49142 _This is a **140b** version of `clsx` that is ideal for Tailwind and/or React contexts, which typically follow this `clsx` usage pattern:_ ```js clsx('foo bar', props.maybe && 'conditional classes', props.className); ``` > **Important:** This `clsx/lite` module **ignores all non-string arguments** and is therefore not a 1:1 replacement for `clsx` itself! ```js import { clsx } from 'clsx'; import { clsx as lite } from 'clsx/lite'; // strings-only usage is identical clsx('foo', null, 'bar', true && 'baz'); //=> "foo bar baz" lite('foo', null, 'bar', true && 'baz'); //=> "foo bar baz" // clsx/lite ignores all non-strings clsx('foo', { a: true, b: false, c: true }); //=> "foo a c" lite('foo', { a: true, b: false, c: true }); //=> "foo" ``` --- > **Full Changelog**: https://github.com/lukeed/clsx/compare/v2.0.1...v2.1.0 ### v2.0.1 - Date: 2023-12-29 - Version: v2.0.1 - Original notes: https://github.com/lukeed/clsx/releases/tag/v2.0.1 - Permalink: https://whatsnew.fyi/product/clsx/releases/v2.0.1 - **changed** — Cache arguments.length and array.length for improved performance ##### Patches - (perf) Cache `arguments.length` & `array.length` for 6% performance gain (#26): deff09b _Adds 5 bytes (+2%) for ~3% avg performance gain_ _Thank you @jalalazimi_ ##### Chores - Update module size: bf64e71 - Update benchmark results: 855eec2, 6e3b2b9, - Replace `nyc` with `c8` in CI: 6e2468e - Update Node CI matrix: 308a238 - Fix readme typos (#76, #82): 42354d3, 4c9a55d _Thank you @andipaetzold and @acusti_ --- > **Full Changelog**: https://github.com/lukeed/clsx/compare/v2.0.0...v2.0.1 ### v2.0.0 - Date: 2023-07-16 - Version: v2.0.0 - Original notes: https://github.com/lukeed/clsx/releases/tag/v2.0.0 - Permalink: https://whatsnew.fyi/product/clsx/releases/v2.0.0 - **added** — Add exports map for native ESM support with TypeScript node16 and nodenext module resolution - **changed** — Maintain CommonJS support with fixed TypeScript definitions ##### Breaking - Add `"exports"` map for native ESM support (#57): 3ec8e9f, 0949868 _Also supports TypeScript's `node16`/`nodenext` module resolution_ _Maintains CommonJS support (with fixed TS definitions)_ _Thank you @remcohaszing~!_ ##### Chores * Add [Tailwind Support](https://github.com/lukeed/clsx#tailwind-support) section to README (#65, #68): 496db1d, 4a4eadd _Thank you @kevinlowe0x3F7 & @kevinlowe0x3F7_ * Add tests for numbers & variadic number arguments: c520353 * Update package module size: 03e1cf9 --- > **Full Changelog**: https://github.com/lukeed/clsx/compare/v1.2.1...v2.0.0