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

Types are incorrect and/or missing #1390

Closed
daviddelusenet opened this issue Feb 7, 2023 · 1 comment · Fixed by #1522
Closed

Types are incorrect and/or missing #1390

daviddelusenet opened this issue Feb 7, 2023 · 1 comment · Fixed by #1522
Labels
enhancement New feature or request TS

Comments

@daviddelusenet
Copy link

daviddelusenet commented Feb 7, 2023

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 mg901 added enhancement New feature or request TS labels Feb 9, 2023
@mg901 mg901 linked a pull request Jun 9, 2023 that will close this issue
github-actions bot pushed a commit that referenced this issue Jun 9, 2023
# [12.1.0](v12.0.4...v12.1.0) (2023-06-09)

### Features

* add strict types for default and custom media queries ([8794580](8794580)), closes [#1390](#1390)
@mg901
Copy link
Owner

mg901 commented Jun 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request TS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants