question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Functional example of decorators?

See original GitHub issue

We are trying to use http://inversify.io/, it uses attribute decorators to inject:

     constructor(@inject(TYPES.Repository) repository) {

     }

but if I try to use mobX configuration (add decorator support), I am still getting:

Module parse failed: Unexpected character '@' (41:21)
You may need an appropriate loader to handle this file type.
| /*#__PURE__*/
| function () {
>   function TestUsage(@inject(TYPES.Test)
|   test) {
|     _classCallCheck(this, TestUsage);

I think this issue is caused by the configuration of webpack in CRA, they are not using ts-loader, but I am not sure.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
duyucongccommented, Dec 13, 2018

Thank you, this did solve my problem. I originally planned to use mobx directly without using the decorator.

0reactions
zhang14725804commented, Aug 12, 2019

@patricklafrance thank you it did work for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Primer on Python Decorators
By definition, a decorator is a function that takes another function and extends the behavior of the latter function without explicitly modifying it....
Read more >
Python Decorators (With Examples) - Programiz
In Python, a decorator is a design pattern that allows you to modify the functionality of a function by wrapping it in another...
Read more >
Decorators in Python - GeeksforGeeks
Decorators are a very powerful and useful tool in Python since it allows programmers to modify the behaviour of a function or class....
Read more >
How to Create and Use Decorators in Python With Examples
Python decorators allow you to change the behavior of a function without modifying the function itself. In this article I will show you...
Read more >
Understanding Python Decorators, with Examples - SitePoint
A function decorator in Python is just a function that takes in another function as an argument, extending the decorated function's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found