Git Product home page Git Product logo

Comments (6)

Alorel avatar Alorel commented on August 11, 2024 1

Pushed some changes, af22ea5...9cd1096.

A unit test PR against the dev branch would definitely be appreciated!

from typescript-proto-decorator.

Alorel avatar Alorel commented on August 11, 2024

Hey, thanks for letting me know these proposals exist (I just use Typescript to transpile my code to es5 and include polyfills through polyfill.io).

I'll make a note and look into these over the weekend. In principal, I'm not opposed to supporting esnext decorators, but I'll want to read up on them first to know about any differences etc. I want this package to be as small and efficient as possible, therefore I might opt to just turn this into a monorepo with some common code and publish the es and typescript versions separately.

from typescript-proto-decorator.

jgonggrijp avatar jgonggrijp commented on August 11, 2024

Hey, thanks for letting me know these proposals exist [...].

Welcome.

I'll make a note and look into these over the weekend. In principal, I'm not opposed to supporting esnext decorators, but I'll want to read up on them first to know about any differences etc. I want this package to be as small and efficient as possible, therefore I might opt to just turn this into a monorepo with some common code and publish the es and typescript versions separately.

Just to get things 100% straight, there is no "typescript version" of decorators. There is a single decorators proposal for ESnext, which has evolved over time. TypeScript and Babel both currently implement the same old version of this proposal, which you can still find over here. Since this old version is the only version which currently has transpiler support, this is also the version that people are currently using, including your package.

So your package is not specific to TypeScript, even though you probably got the how-to from this page in the TypeScript handbook. This is why I'm suggesting to remove "typescript" from the name of your package and to add some checks so that Babel users can rest assured that your decorator will work for them, too. You are using TypeScript for the implementation of your package and you can continue doing so, but this doesn't have to prevent your users from using a different transpiler.

The latest version of this same decorators proposal is what I linked to above (this one). At some point, transpilers will catch up and start implementing this later version. It would be nice if your decorator would continue to work in this (near) future, which is why I'm proposing to make your decorator forward-compatible.

from typescript-proto-decorator.

Alorel avatar Alorel commented on August 11, 2024

Take a look at this PR - did I get the forward compatibility right? Seems to work fine on https://babeljs.io/repl.

from typescript-proto-decorator.

jgonggrijp avatar jgonggrijp commented on August 11, 2024

Thanks @Alorel, I left a review. I don't think you got the forward compatibility right, but no wonder with a first blind guess in the dark (as there is currently no way to test new-style decorators).

It's uplifting (if not very surprising) to hear that your decorator appears to work with Babel as well. How about always checking this in the Travis build? Would you appreciate a pull request for that?

from typescript-proto-decorator.

Alorel avatar Alorel commented on August 11, 2024

🎉 This issue has been resolved in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

from typescript-proto-decorator.

Related Issues (8)

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.