lukeed/clsxPublic

A tiny (239B) utility for constructing `className` strings conditionally.

TypeScript support

MA

First of all love this lib! Neat. :100:

TypeScript people had `@types/classnames` - with this lib being a drop in replacement, should we fork that typings, or simply include it in this repo.

```ts declare module 'clsx' { type ClassValue = string | number | ClassDictionary | ClassArray | undefined | null | boolean;

interface ClassDictionary { [ id: string ]: any; }

interface ClassArray extends Array<ClassValue> { }

type ClassNamesFn = (...classes: ClassValue[]) => string;

type ClassNamesExport = ClassNamesFn & { default: ClassNamesFn };

const classNames: ClassNamesExport;

export = classNames; } ``` > sourced from: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/classnames/index.d.ts

Not sure if you wan't to include this in your project as a `index.d.ts` in the root.

  1. maraisrreferenced this in feat: added a typescript defs file #47 years ago on GitHub

  2. LU

    Hey, thank you~! 🙌

    I'm not really a fan of TypeScript – so my thinking here was that the `@types/classnames` could be used instead (since usage is meant to be identical), ignoring the extra `bind/dedupe` bits, or we could fork it in the DefinitelyTyped repo & publish as its own name.

    What do you think?

  3. MA
    Author

    Yeah sure - we could fork and rename. We just can't use the same lib (@types/classnames), as it binds to a different module.

    Would I be right in leaving this for you to handle?

  4. LU

    Awesome – did not know that 😆

    It's up to you. Happy to let you take it on over there. If you tag me I'll review & approve! But if you don't want to expend any additional effort, I'll add it to my list.

  5. maraisrreferenced this in Added a typescript defs file #57 years ago on GitHub

  6. RO

    @maraisr for reference here is a pull at rifm that I just did to add dtslint and tests. Should be a similar thing here https://github.com/istarkov/rifm/pull/40

  7. maraisrmentioned7 years ago on GitHub

  8. maraisrsubscribed7 years ago on GitHub

  9. lukeedclosed7 years ago on GitHub

  10. LU

    @maraisr Added types to this repo perfectly – I was just being stubborn & not wanting to be held responsible for maintaining types in the future 😇

  11. maraisrmentioned7 years ago on GitHub

  12. maraisrsubscribed7 years ago on GitHub