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.

Compiler error using @key decorator

See original GitHub issue

I have tested the simpler subscription examples successfully, and now I am trying autosubscriptions using the @key decorator, such as in your example:

@autoSubscribe
    getTodosForUser(@key username: string) {
        return this._todosByUser[username];
    }

Unfortunately, I get a compiler error:

Error: Module parse failed: Unexpected character ‘@’ (1:20609) You may need an appropriate loader to handle this file type.

It seems like Babel has a problem with the @key decorator being used within a function, and not with other decorators like @autoSubscribe and @AutoSubscribeStore.

I’ve checked my babel.config.js and everything seems OK, using:

  const plugins = [
    ['@babel/plugin-proposal-decorators', { legacy: true }],
    ["@babel/plugin-proposal-class-properties", { "loose": true}]
  ];

Did someone else come across this problem? Any recommendation on how to solve this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:21 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
WarnerHoohcommented, Jul 25, 2019

Hi @thegalah,

Thanks for the feedback, I had a quick fix in 1.0.9. Hope all good if you try with this version.

1reaction
deregtdcommented, May 20, 2019

Several of the unit tests use @key. You can start with one of those build systems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Insert with object as key fails to compile? - Stack Overflow
I don't understand the error thrown out by the compiler. Some code to illustrate the problem is below. #include <map> using namespace std; ......
Read more >
Method decorator compile to ES5 get error #6865 - GitHub
When i am creating class with function like below it is giving me PropertyDescriptor undefined for method decorator. function editable(value : ...
Read more >
Error Handling in Compiler Design - GeeksforGeeks
An Error is the blank entries in the symbol table. Errors in the program should be detected and reported by the parser. Whenever...
Read more >
Compile Errors | Online Documentation for Altium Products
To open the Compile Errors panel, click the Design Compiler button at the bottom-right of Altium Designer and select the Compile Errors entry...
Read more >
Common Flutter errors
This page explains several frequently-encountered Flutter framework errors and gives suggestions on how to resolve them. This is a living document with more ......
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