Giter Site home page Giter Site logo

Comments (9)

danpaz avatar danpaz commented on June 24, 2024 1

Branch is created: https://github.com/danpaz/bodybuilder/tree/ts-migration

from bodybuilder.

johannes-scharlach avatar johannes-scharlach commented on June 24, 2024

@johnnyraphic Take a look at https://github.com/johannes-scharlach/elasticbuilder

2 years ago I did an almost complete re-write of bodybuilder in TS while copying most of the tests from this project. And since bodybuilder hasn't really changed since then this should still be up to date.

You can think of that project as a major update to bodybuilder with a breaking API change (and without any testing in production so far).
What's missing to merge it back into this project is backwards compatibility to the (very versatile) bodybuilder API. I believe that that's actually possible, so if you want to make bodybuilder work with TS, that's probably the easiest path.

from bodybuilder.

danpaz avatar danpaz commented on June 24, 2024

FWIW I'd be fully supportive of this, it's been a while since the TS type definitions were added and there for sure is room to improvement.

Is it possible to implement this in pieces instead of a complete rewrite? e.g. with allowJs: true in tsconfig

from bodybuilder.

johannes-scharlach avatar johannes-scharlach commented on June 24, 2024

Back when I did that rewrite, I saw no good way to get started on a gradual approach. I don't recall all the details why and now when you compare my rewrite with bodybuilder, you see that the file structure is very similar.

It might be possible to compare the two repos and figure out some ways to do this gradually.

I have in the end completely changed the way data is represented internally in the builders without affecting the external API. There because the internal state within bodybuilder isn't covered with any JSDoc types.

from bodybuilder.

JonathanDagan avatar JonathanDagan commented on June 24, 2024

@danpaz To be honest you could do something like you suggested with allowing js to do a partial migration but tbh i don't see why you would like to do that since the code base isn't that big imo to go for that approach since it would be more of a hindrance than helpful imo.

Is there any reason I'm missing here with the partial migration to TS?

from bodybuilder.

danpaz avatar danpaz commented on June 24, 2024

from bodybuilder.

JonathanDagan avatar JonathanDagan commented on June 24, 2024

so I would recommend that we create a ts migration branch or something in the repo and than we can create multiple PRs just as you said and that would be more manageable to that branch and once that branch is ready we will merge it to the master branch and create a new release that supports es import properly

from bodybuilder.

danpaz avatar danpaz commented on June 24, 2024

👍 sounds good! Thanks for kicking this off

from bodybuilder.

JonathanDagan avatar JonathanDagan commented on June 24, 2024

Sure thing :)

I'll wait for you to create the branch and you can tag me or something and ill start working on that.

I would recommend that if you have any specification as to how you would like stuff to be typed or as to how stuff would look out, to write it out before people would start working on that to try and make this as efficient as possible.

from bodybuilder.

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.