diff --git a/bind.d.ts b/bind.d.ts index 0cdd158..f89f787 100644 --- a/bind.d.ts +++ b/bind.d.ts @@ -4,6 +4,14 @@ declare namespace classNames { type Binding = Record; } -declare function classNames(this: classNames.Binding | undefined, ...args: ArgumentArray): string; +interface ClassNames { + (this: classNames.Binding | undefined, ...args: ArgumentArray): string; + + default: ClassNames; +} + +declare const classNames: ClassNames; + +export as namespace classNames; export = classNames; diff --git a/dedupe.d.ts b/dedupe.d.ts index aba56f7..392248a 100644 --- a/dedupe.d.ts +++ b/dedupe.d.ts @@ -1,2 +1,5 @@ import classNames = require('./index.js'); + +export as namespace classNames; + export = classNames; diff --git a/index.d.ts b/index.d.ts index cc199f3..3a30112 100644 --- a/index.d.ts +++ b/index.d.ts @@ -15,9 +15,17 @@ declare namespace classNames { type Argument = Value | Mapping | ArgumentArray; } +interface ClassNames { + (...args: classNames.ArgumentArray): string; + + default: ClassNames; +} + /** * A simple JavaScript utility for conditionally joining classNames together. */ -declare function classNames(...args: classNames.ArgumentArray): string; +declare const classNames: ClassNames; + +export as namespace classNames; export = classNames; diff --git a/tests/types.ts b/tests/types.ts index fef052c..be8c2c0 100644 --- a/tests/types.ts +++ b/tests/types.ts @@ -3,6 +3,7 @@ import dedupe = require('classnames/dedupe'); import bind = require('classnames/bind'); // default +classNames.default('foo'); classNames('foo'); classNames(null); classNames(undefined); @@ -44,6 +45,7 @@ classNames({a: true}, 'b', 0); classNames({}, Infinity, [{}, []]); // dedupe +dedupe.default('foo'); dedupe('foo'); dedupe(null); dedupe(undefined); @@ -68,6 +70,7 @@ dedupe([Symbol()]); dedupe([[Symbol()]]); // bind +bind.default.bind({foo: 'bar'}); const bound = bind.bind({foo: 'bar'}); bind.bind(undefined); // $ExpectError