mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-16 11:02:11 +08:00
classnames: initial commit
This commit is contained in:
17
classnames/classnames-tests.ts
Normal file
17
classnames/classnames-tests.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
///<reference path='classnames.d.ts' />
|
||||
|
||||
import classNames = require('classnames')
|
||||
|
||||
classNames('foo', 'bar'); // => 'foo bar'
|
||||
|
||||
classNames('foo', 'bar'); // => 'foo bar'
|
||||
classNames('foo', { bar: true }); // => 'foo bar'
|
||||
classNames({ foo: true }, { bar: true }); // => 'foo bar'
|
||||
classNames({ foo: true, bar: true }); // => 'foo bar'
|
||||
|
||||
// lots of arguments of various types
|
||||
classNames('foo', { bar: true, duck: false }, 'baz', { quux: true }) // => 'foo bar baz quux'
|
||||
|
||||
// other falsy values are just ignored
|
||||
// NOTE: We don't really want to allow this kind of thing with Typescript (otherwise what's the point!)
|
||||
//classNames(null, false, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
|
||||
13
classnames/classnames.d.ts
vendored
Normal file
13
classnames/classnames.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// Type definitions for classnames
|
||||
// Project: https://github.com/JedWatson/classnames
|
||||
// Definitions by: Dave Keen <http://www.keendevelopment.ch>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface ClassDictionary {
|
||||
[id: string]: boolean;
|
||||
}
|
||||
|
||||
declare module "classnames" {
|
||||
function classNames(...classes: (string|ClassDictionary)[]): string;
|
||||
export = classNames
|
||||
}
|
||||
Reference in New Issue
Block a user