Aurelia 2.0.0-beta.17 decorator error

I have created new project with npx makes aurelia.
Command line: npx makes aurelia new-project-name -s typescript,shadow-dom,less,app-with-router
I make simple code:
import { bindable } from “aurelia”;

export class NavyDropdown{
@bindable allowClose: boolean = false;
}

And I got errors:
TS1240: Unable to resolve signature of property decorator when called as an expression.
No overload matches this call.
Overload 1 of 4, ‘(: undefined, context: ClassFieldDecoratorContext<unknown, unknown>): void’, gave the following error.
Argument of type ‘NavyDropdown’ is not assignable to parameter of type ‘undefined’.
Overload 2 of 4, '(
: Function, context: ClassGetterDecoratorContext<unknown, unknown>): void’, gave the following error.
Argument of type ‘NavyDropdown’ is not assignable to parameter of type ‘Function’.
Type ‘NavyDropdown’ is missing the following properties from type ‘Function’: apply, call, bind, prototype, and 5 more.

How to fix it?
I got same error with @lifecycleHooks()

1 Like

@redone218 it’s likely you are still having experimentalDecorator: true in your tsconfig.

We’ve updated all our decorators to follow latest TC39 spec now, which means you’ll need to remove that config from your tsconfig.

You can read more here for clearer steps: Release v2.0.0-beta.15 · aurelia/aurelia · GitHub

4 Likes

Sorry, I will update our skeleton to remove that from tsconfig.
Update: done.

4 Likes

Thank you for responding. I have solved the problem.
Change tsconfig.json:
“emitDecoratorMetadata”: false,
“experimentalDecorators”: false,

@redone218 instead of setting them to false, you should remove them completely to avoid confusion. It’s just a suggestion

1 Like