Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript support #3

Closed
maraisr opened this issue Dec 26, 2018 · 5 comments · Fixed by #5
Closed

TypeScript support #3

maraisr opened this issue Dec 26, 2018 · 5 comments · Fixed by #5

Comments

@maraisr
Copy link
Contributor

maraisr commented Dec 26, 2018

First of all love this lib! Neat. 💯

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.

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.

@lukeed
Copy link
Owner

lukeed commented Dec 26, 2018

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?

@maraisr
Copy link
Contributor Author

maraisr commented Dec 26, 2018

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?

@lukeed
Copy link
Owner

lukeed commented Dec 26, 2018

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.

@rosskevin
Copy link

@maraisr for reference here is a pull at rifm that I just did to add dtslint and tests. Should be a similar thing here realadvisor/rifm#40

@lukeed lukeed closed this as completed in #5 Jan 11, 2019
@lukeed
Copy link
Owner

lukeed commented Jan 11, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants