GithubHelp home page GithubHelp logo

Comments (9)

paul-sachs avatar paul-sachs commented on May 22, 2024

I believe a simple fix to this line would do:

return typedPath(handlersConfig, [...path, name.toString()], true);

Changing it to something like:

return typedPath(handlersConfig, [...path, (typeof name === 'number' ? name : name.toString())], true);

This would break some typing currently in place but would also make sure we support ramda properly.

from typed-path.

bsalex avatar bsalex commented on May 22, 2024

Hi @paul-sachs
Thanks for the report.

I've added another default handler, .$rawPath, to keep backward compatibility.
Could you try your scenario with version [email protected] and .$rawPath?
https://github.com/bsalex/typed-path/tree/beta#rawpath

from typed-path.

paul-sachs avatar paul-sachs commented on May 22, 2024

@bsalex Yeah I'll give it a shot in the next few days. Thanks for the quick response.

from typed-path.

paul-sachs avatar paul-sachs commented on May 22, 2024

@bsalex looks better. I think my version of ramda has problems with the (string | number | symbol)[] bit though, works fine with (string | number)[]. Might just my version of ramda types though (@types/[email protected]) so I can work around that with a simple cast.

from typed-path.

bsalex avatar bsalex commented on May 22, 2024

@paul-sachs
Thanks.

Could you clarify whether the changes in the 2.2.0-beta.0 fixed the issue you have with ramda (with the workaround)?
The goal is to push the changes to the public package if they help.

Also, it would be great to add documentation for a simple use case with ramda.
Could you share an example for the issue that you've encountered?

from typed-path.

paul-sachs avatar paul-sachs commented on May 22, 2024

@bsalex yeah, i'll write something up shortly. My example is pretty nested in an application so I'll simplify and put something together.

from typed-path.

paul-sachs avatar paul-sachs commented on May 22, 2024

@bsalex I've created a simple codesandbox to show the issue: https://codesandbox.io/s/thirsty-sunset-q85b2?file=/src/App.tsx

You can see the change in array status if you switch to an older version of typed-path (and replace $rawPath with $raw)

from typed-path.

bsalex avatar bsalex commented on May 22, 2024

Thanks for the contribution,
[email protected] has been published
https://www.npmjs.com/package/typed-path

from typed-path.

bsalex avatar bsalex commented on May 22, 2024

I'm closing the issue, thanks again for the report.
Feel free to open another issue if you encounter a problem.

from typed-path.

Related Issues (7)

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.