ui5-community / ui5-community/babel-plugin-transform-modules-ui5

[FEATURE REQUEST] Support typescript decorators

Open
#138 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
33
Forks
20
Avg merge
3h 22m
Merged PRs (30d)
1

Description

In ts config

...
"experimentalDecorators": true,
...

in ts code

class BigButton extends Button {
...
    @someDecorator()
    fun1() {}
...
}

What to expect:

We hope the decorator will be compiled in target js file

Current:

In js file, the decorator only imported but not used

More info:

I try to write a babel plugin to handle the decorator, but when the babel visit the ClassMethod node, what I found:

  1. node.decorators is null
  2. the function name should be fun1, but what I get is _fun1

But when I remove the transform-ui5 preset, all information is correct.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the TypeScript example with experimentalDecorators enabled and the transform-ui5 preset, then inspect the Babel ClassMethod visitor. Compare the AST with and without transform-ui5; done means the decorator is emitted and used in the target JavaScript rather than only imported, while the method remains correctly identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
babel, typescript
Domain
build-system, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.