the original classname() accepts boolean, as well as falsy values

This commit is contained in:
FUJI Goro (gfx)
2018-05-14 11:52:54 +09:00
parent 9028a63234
commit 4c25d57e2f
2 changed files with 4 additions and 1 deletions

View File

@@ -38,3 +38,6 @@ const className = cx('foo', ['bar'], { baz: true }); // => "abc def xyz"
// falsey values are just ignored
cx(null, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
// true is just ignored
cx(true || "foo");

View File

@@ -9,7 +9,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | false;
type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | boolean;
interface ClassDictionary {
[id: string]: boolean | undefined | null;