Decorators are not valid here

I’ve got this piece of code


As you can see the @IRouter decorator is marked with a red squiggly and the message is Decorators are not valid here. As far as I know what I’ve got here is similar to what’s in the docs. This application is written with Aurelia 2 beta 18 and webpack 5.91.0. I’ve got another application written with Aurelia 2 beta 1 and an older webpack version than above and there I don’t get the above mentiond error .

Any ideas, anyone?


It’s your editor complaining here, I guess vcode?
Do you use something like eslint to validate your code? What is the version of that package in your project?

It looks like a mismatch between the versions that are used for validation, versus the version of typescript / aurelia, and/or configuration error.

Parameter decorators are not supported as of beta15. More info here: Release v2.0.0-beta.15 · aurelia/aurelia · GitHub


Fortunately I’m using the latest version of Typescript and my tsconfig.json file already had the recommended changes, so the only thing missing was the use of Aurelia’s resolve function. Changed my code and now the error is gone.

Thanks for your help, @davidsk :slight_smile:


1 Like