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 error when using Augmented CSS in React v18 #285

Open
user1990 opened this issue Feb 12, 2023 · 2 comments
Open

TypeScript error when using Augmented CSS in React v18 #285

user1990 opened this issue Feb 12, 2023 · 2 comments

Comments

@user1990
Copy link

Description

In a Next.js project, we have the following minimal component:

import ReactSlider from "react-slider"

<ReactSlider
  renderThumb={(thumbProps) => <div {...thumbProps} />}
  renderTrack={(trackProps) => <span {...trackProps} />}
/>

We have augmented CSS variable type react.d.ts:

import 'react';

declare module 'react' {
  interface CSSProperties {
    [key: `--${string}`]: string | number | undefined;
  }
}

Error

Index signature for type '--${string}' is missing in type 'Properties<string | number, string & {}>'.ts(2322)

image

The issue may have arisen due to a mismatch in React versions, as the react-slider seems to have used React v17.0.2 as founded in the .lock file, while this issue was not present in React v17?

Environenment

Library Version
React.js 18.2.0
Next.js 13.1.6
React-Slider 2.0.4
@types/react-slider 1.3.1
@bertPB
Copy link

bertPB commented Feb 27, 2023

Having the same issue here, did you manage to fix this?

Any update on this?

@user1990
Copy link
Author

Having the same issue here, did you manage to fix this?

Any update on this?

No any updates/response, still having this issue. Currently using this workaround:

<div {...thumbProps} {...preventSwipingHandlers} style={{ ...thumbProps.style }} />

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

No branches or pull requests

2 participants