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.

Error "@computed can only be used on accessors or fields..." using task decorator with modifiers

See original GitHub issue

Writing code like explained in the tutorial “Version 3: Preventing Concurrency (with Tasks)” throws an exception:

Error: Assertion Failed: @computed can only be used on accessors or fields, attempted to use it with seriesAddTask but that was a method. Try converting it to a getter (e.g. get seriesAddTask() {}) image

My code is:

import { task } from 'ember-concurrency';
....
@task({ drop: true })
    *seriesAddTask() {
        ....
    }

I’m using ember-concurrency 2.0.3.

Writing it in this other way works fine:

@(task(function* () {
    ....
}).drop()) seriesAddTask;

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
davideferrecommented, Mar 18, 2021

I’m using npm but you have found the problem!

├── ember-concurrency@2.0.3 └─┬ ember-google-maps@3.3.0 └── ember-concurrency@1.3.0

There’s a way to solve the problem without uninstalling ember-google-maps?

0reactions
davideferrecommented, Mar 18, 2021

With yarn, you can force it with resolutions. Not sure if there’s an npm equivalent? Otherwise, you may need to contact the upstream author to relax the dependency range or have them push a new version with v2 support.

Ok, thank you so much!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to create a setter for an observable prop #839 - GitHub
I noticed a repeated pattern in my code setup, usually in my store i would have some observables defined as follows: @observable loading: ......
Read more >
Python's property(): Add Managed Attributes to Your Classes
In this step-by-step tutorial, you'll learn how to create managed attributes, also known as properties, using Python's property() in your custom classes.
Read more >
Native Classes - Octane Upgrade Guide - Ember Guides
Decorators are modifiers that change the behavior of a field, method, or class. Native decorators are functions that get applied using the @...
Read more >
Advanced TypeScript 4.8 Concepts: Classes and Types
Gain a deeper understanding of how TypeScript's type system enhances classes via interfaces, access modifiers, decorators and other features ...
Read more >
typescript-cheatsheet - GitHub Pages
A set of TypeScript related notes used for quick reference. The cheatsheet contains references to types, classes, decorators, and many other TypeScript ...
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