AUR0022
The @inject decorator on the target ('xxxx') type 'yyyy' is not supported.
Error message
The @inject decorator on the target ('xxxx') type 'yyyy' is not supported.
Parameters
Target name (string)
Target type (string)
Error explanation
This error occurs when the @inject decorator is used in a way that is not supported by Aurelia's DI system. For example, applying @inject to a field, method, or other unsupported target will trigger this error. The @inject decorator is intended for use on classes and, in some cases, constructor parameters.
Common causes
Using
@injecton a field, method, or property instead of a class or constructor parameter.Incorrect usage of the decorator in TypeScript or JavaScript code.
Attempting to use
@injectin a context not supported by Aurelia's DI system.
How to fix
Only use
@injecton classes or constructor parameters.Review the documentation for correct usage of the
@injectdecorator.Refactor your code to move dependency injection to supported locations (class or constructor).
Debugging tips
Check the stack trace to see where the invalid
@injectusage occurred.Search your codebase for all usages of
@injectand verify they are on classes or constructors.If using plugins, try disabling them one at a time to isolate the source.
Last updated
Was this helpful?