Coder Social home page Coder Social logo

Comments (2)

Tigge avatar Tigge commented on August 15, 2024 1

Fair enough. I can appreciate that. That linting rule is also not included in the recommended set so I doubt there will be many with this "issue". The other approach with this: void probably makes a little bit more sense in this context but then again it mostly would cater to this linting rule.

There are some more subtle use for having this: void, it would also prohibit usage of this within the functions. There are mentions of this in the old ts docs, https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters - but nothing in the new ones as far as I can see. Won't add much - but yeah, let me know if you could accept something like that, if not, feel free to just close this of course.

Thank you for your time 🙌

from wonka.

kitten avatar kitten commented on August 15, 2024

Hiya 👋 While I'd love to accept the issue and the corresponding PR, I'm failing to determine a reason to, sorry!

To keep it short, a random ESLint rule, that is not being applied to this repository is unfortunately not a reason to accept this issue and PR. Because no function in wonka is actually using an execution context, whether the function ends up being called bound or unbound is irrelevant. In fact, it would be pretty odd to call it bound to any given context, as there's no relevant need to. It simply does not use prototype inheritance in any sense.
This is why the difference is merely in coding style.

What's also published in the final package output, is basically transpiled & compiled code, as per the Rollup configuration: https://github.com/0no-co/wonka/blob/main/rollup.config.js
As part of this, it's a transpilation detail of whether the functions end up being arrow functions, function expressions, or function declarations. However, writing them as function declarations has the advantage of often not being transpiled away and retaining their name even when minified. This is nice for debugging in Node environments, where sourcemaps are often not used. However, in any browsers, even with a bundler, sourcemaps are still used and make the difference between styled negligible.

I hope that makes sense to you 🙌

from wonka.

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.