Coder Social home page Coder Social logo

Comments (4)

dcousens avatar dcousens commented on July 25, 2024

Hi @rafeekasharaf,

Could you please provide an example of how to reproduce this type error?

from classnames.

paulinecpz avatar paulinecpz commented on July 25, 2024

Hey there,
Getting the same error
typed as follow :
const cx = classNames.bind(styles) as typeof classNames;

used as follow :

<div className={cx('white-bg')}>HELLO</>

I could correct it typing like this, but this is not type safe.
const cx = classNames.bind(styles) as (...args: any) => string;

Can you suggest a better way please?

from classnames.

tony avatar tony commented on July 25, 2024

Does pinning classNames exactly help? e.g.

{
  "dependencies": {
    "classnames": "2.3.1"
  },
  "resolutions": {
    "classnames": "2.3.1"
  }
}

This fixed it for me.

My yarn.lock shows classnames versions - my package.json was set to ^2.3.1), but I had 2.2.x and 2.3.x in my lockfile.

from classnames.

jonkoops avatar jonkoops commented on July 25, 2024

Seems like this is a type-safety issue stemming from the fact that Function.prototype.bind() itself is not type-safe, and instead returns any. This seems to be the same issue as #299, so I will close this as a duplicate.

from classnames.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.