classnames-generics
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Welcome 😀

GitHub Actions status

classnames-generics

Use the classnames library more type-safely.

Install

npm i classnames-generics

Usage

import {classNames } from 'classnames-generics';

classNames<'foo' | 'bar'>('foo', 'bar');
classNames<'foo' | 'bar'>('foo', { bar: true });
classNames<'foo-bar'>({ 'foo-bar': true });
classNames<'foo-bar'>({ 'foo-bar': false });
classNames<'foo' | 'bar'>({ foo: true }, { bar: true });
classNames<'foo' | 'bar'>({ foo: true, bar: true });
classNames<'foo' | 'bar'| 'duck' | 'baz' | 'quux'>('foo', { bar: true, duck: false }, 'baz', { quux: true });

import {classNamesFunc } from 'classnames-generics';

const classNames = classNamesFunc<'foo' | 'bar'>();

classNames('foo', 'bar');
classNames('foo', { bar: true });

Package Sidebar

Install

npm i classnames-generics

Weekly Downloads

547

Version

1.0.9

License

MIT

Unpacked Size

5.09 kB

Total Files

6

Last publish

Collaborators

  • mustache-master