mg901/styled-breakpoints

Types are incorrect and/or missing

Closed this issue · 1 comments

First of all, thanks for maintaining this library! One of the few that hasn't been left for death.

However, I've been running into some issues when using this package in a TypeScript project.

First of all, the up/down/between/only function parameter is not strictly typed. It would be nice if the keys from the createTheme object would be used here. Now this parameter is just of type string. However, I can still use the package fine without this strict typing.

Another thing which is causing a bigger issue: the return value of the up/down/between/only functions. At the moment that is any, which causes an error when using these functions in combination with useBreakpoint:

const isDesktop = useBreakpoint(up("lg"));

// The following ESLint error is being thrown:
// Unsafe argument of type `any` assigned to a parameter of type `Function`.

Let me know if you need any more information!

mg901 commented

Hi, @daviddelusenet. Sorry for my too long answer. Thank you for your feedback and for using this library. I appreciate your kind words and I'm glad to hear that it has been helpful to you.

You could try to use styled-components v12.1.0. Styled Breakpoint is now strongly typed, more performant, size reduced by 2 times and performance increased.

I will be very glad to your feedback.